refactored pointer collision detection