Hey thanks.
I managed to do it with dcd a bit like my previous post with a few tweaks to get it right but it is not nearly as efficient as yours. I think I almost get what is going on now.