Robustified collision code