Move if switch out of for loop in GChat