Cleaned up Simulation code.