Improved collision

Collision is more accurate and happens even if the mouse is not moving.