Refactored request.rb