Did a whole bunch of refactoring... More to come...