code changed for package likelihood in cran