change sorting function