add client, refactor