Adding a comparison method to sort children by priority order