You're quite welcome! It was a fun challenge, and it's nice to be helpful. Remember my partner and I are building a digital step sequencer with CV/gate/accent out anyway. :D This isn't too far removed from that sort of thing, in terms of the knowledge required to make it. The most esoteric part is probably just the bitshifting.
All the best,
Zoë.