tidy up the project and added unit tests