Improved getRectangles and clarity