Merge up major refactoring work

Merge the major changes from the `feature/newstuff` branch in now that initial features have all been re-implemented and development has slowed.