modified sort()