Completely restructured code. Fixed some bugs. Closes #4.
release 0.6.0
Merged with upstream