Sort only the last segment