Added a better sort function to Utils