Added test cases and fixed final issues with client