Small search sort refactor