Updated simulation.js