more simulation code