Re-write of most
Merge pull request #4 from oompt/master

Re-write of most