add rectangle.
some code modified.