More bugs fixed. Lines are now properly inserted, and the intersection calculations are ok.