Collision checking code

I included code for manually checking collisions.