added 2d collision detection