Added additional debug controls.
Refactored some code and added framework to display debug line intersections.