Merge pull request #34 from joeldrapper/master

Lots of refactoring and improvements