Merge in new module pattern

Rewrote engine into multiple files for scalability