reworked query sort param building