refactor client api