sort by ration function added.