Replace local sort callback with an existing function

Change-Id: I3e834312fa80bb4c62e27ea1b3b494ad7bcea277