Simplified code for keeping query string vars intact
Merge pull request #2220 from GeertDD/sorting

Simplified code for keeping query string vars intact