Messy but is a major rewrite
Merge pull request #8 from Smilex/overhaul

Messy but is a major rewrite