Changes to simulation code