Long term, all this needs to be converted to a state machine. Change-Id: I757a04994cd04e490a632b433e62b00a23880638