move max function to MDP class