Updates to readme. Code cleanup. Adds tests.