[WIP]
[WIP]
[FOLD] tidying
[FOLD]
[FOLD] hook in test
[FOLD] test fixes
[WIP] More unit tests