initial simulation code