Cleaned up code and added test case