[refactor] extract the collision detector