Collision and some refactoring