Implemented maxlikelihood