Vincenzo's smatrix speedup.