update chi_test with functions