Refactor processLoadStateMachine in preparation for error handling.