refactored query string