Rewrote some raytracing; added corner snap