Greatly reduced the complexity of the width/height methods. This also fixes #2009...