Corners are now rounded by getting the structure region rather than the content region.

Also a bit of rearranging.
Added commented-out code to get the actual title text region.