refactored query parameter pattern matching