Part of the huge rewrite.
Merge pull request #2 from oscarpalmer/dev

Part of the huge rewrite. Nice.