break out into separate files
clean up nested functions
remove accidentally added file
Merge pull request #1 from wasbazi/modularize

Modularize