refactoring queries to request.url()