#100 planning sort function