Finished refactoring, ready for persistence