clean up and unit test