Partial solution to CF451B, need to fix to work for segments.