New state/restart approach done and debugged.