client request handler refactoring