Properly apply query string cleaning logic