Fixed a number of bugs. Upgrade to v1.0