implemented overlapping of basic rects