move a likelihood calculation function into a new module