Use namespaces to fix name conflict when compiling the tests.
Added tests for the client functions.
Fixed bugs to allow the tests to pass