Refactored request handling to use an object with class methods