Generalize find + sort functions