Updated collision code