* many refactors. * remove multi_loglossova. * fix tests. * avoid using lambda function. * fix some format. * reduce branching.