now working for log-linear, as well