refactored and more object-oriented. Added Simulation class