clean up sort method