first time trying to merge fork into master.

Rewritten version of the v0.9.9. Removed various unused features and switched to using classes.