clean MLE code