Working on adding tests and cleaning up code