Refactored collision detection into separate methods