Added limit and sorting to sort()