Adding collision detection loops