Refactoring of NetworkPlanner sorting functions