Many squashed commits
Merge pull request #14 from jackfirth/master

Some refactoring