Got the deviance and REML functions working.