cleaned up some code, added a test, edited readme