Compute likelihoods correctly.
Various cleanups and optimisations in the wake of the big likelihood fix.