Refined calculations in calculateComponentHeights()