cleaning up code and testing