Detecting upper and lower collisions. Adding debugging rectangles for collision detection