More changes to simulation code