refactor into modules and employ "initialisation privatisation". Add some (crappy) unit tests and static analysis, mainly to prove out the frameworks