Code cleanup, client API switchout, tests cleanup