Clarified variable names and comments.  Tested with chi2_score.