added chisq stuff