Rewrite of the simulator