added feature sort functions to query