updated deviance calculation