refactor request-handler