Beginning main simulation loop.