Tried to make lines into rectangles. Reveals there is something wrong with calculations (rectangles aren't always perpendicular). Don't know why