WIP - lots of refactoring and new work