added ability to sort results in index