cleaned up code and removed extra test cases