Refactor to tidy up code
Merge pull request #27 from reggieb/code_tidy

Refactor to tidy up code