adding tests and cleaning up