Updated simulation, fixed bugs, used for figures.