Refactor state machine to remove StateContext from state implementation methods and use Initializer instead.