better collision code