centring the rectangle

and adding a temporary limit to the size of rectangle