Made the sort method function properly.