clean up and added more tests