Simulation code (nearly) finished. Needs review