Refactor code

Fixes #19.
Fair enough, I have a habit of putting them in my repo gitignore :)