optimized cell collision func