Refactoring, tests for RequestHandler