update simulation code