intersection algorithm working, however it needs more testing