added sorting to results