More refactoring and moving stuff around.
Working reasonably well