Seperated intersection.c as it was getting pretty long.