updated mdp to use previous location instead of direction.
more updates to the code.