a bit of refactoring of collision