Modularize

Modularizing code for future revisions