refractoring entirly my algoritms for intersecting rectangles.