MAINT: further decompose the log likelihood calculation for testing