new simulation code