collision detection implemented