somewhat fixed the intersection method, added debugging output code