Added simulation code