Working value iteration.