Revise Categorical MLE code