Merge pull request #4 from tux3/master

Rebase on upstream
Fix bug #58, clean up some uneeded code
Merge pull request #83 from F1ynn/master

Fix bug #58, remove some uneeded code