Better calculation of heights and widths.