loglikelihood function complete/needs testing