Refactors logic in request_handler to factory and response classes
Coding yo