Refactored the total_log_likelihood function: now private function extracts data.