Added the Simulation class and the main loop