Change sort method to generic type.