modified code to work with outerHeights/Widths