remove the check of initDone, use beginLoop for declareVariables