cleaned up code, added comments and improved tests