First version for likelihood function
Merged changes