implemented attaching connected line to the rectangles