work in progress
This branch is deferred, the refactor is too extensive.