This method needs to be tightened up, it's a clean function with a clear purpose - but can be disastrously slow for larger numbers of rows.  I'm OK with iterating through each section, but not each row.  Perhaps add a section height cache here.