Refactored maximum likelihood code
Documentation