Implementing the simulator