adding sorting function (partial)