pseudocode for collisions