add sort func to repo