Sort function added