Adding test cases, making the code loosely coupled