begin refactoring request handler

Please enter the commit message for your changes. Lines starting