Optimizing junction segments