Jeremy dev

Major refactoring and restructuring.