unified the two sorting api's