migrate the code to using a 3D matrix survival table