Added simulation code.