First stab at rewrite.
Merge pull request #26 from kylerush/rewrite

Rewrite