revised reducer for de depulicate entries and sort by len