client: refactor