Unit tests

Added unit test and cleaned up everything for the official release.