Add validation. Fix bugs in realtime simulation.