Refactor

Hey John,

Can you pull down this branch and do some QA. I did some refactoring splitting classes and modules into separate files and some other things.

Nick