Refactoring the code to separate client and logic; also added in 2 empty test cases which were missed earlier