inproved isHit and added collision detection