Nevermind - this is solved. I will post the code as soon as I refine it.