further working on sorting