Implemented other variant of painting rectangles