Remembering this stuff

This is old code, and was PoC... need to remember the thinking behind
certain bits and fix