Add init state and clean up handling of retries.
Update state diagram.