request.rb: refactored