Refactored code - using request object