MAINT: speed up the likelihood evaluation by using two-stage decomposition and other optimization tweaks