started adding new sorting function