Refactor code to be in modules and cleaned up a bit
Merge branch 'modularize-code'