Collision detection

Added collision detection