Adding simulation code