Added Chi-squared test to RTFiltLoop()