Improving code logic in Bellman computations