made computation of marginal likelihood more efficient