moved filtering function to TextFilter class