Some basic modularization. Need to consider how to bring all the modules together.  The current structure looks too busy.