Switch to enum for state and add unit test for clearing retryCount
sooner.