Refactoring request.query()