Major refactoring... continued