adds collision detection