Uncommitted changes

Things are in a broken state at the moment.

Loads of refactoring required