void instructionDispatchLoop() throws ScriptException {
		long timeBegin = 0;
		int ifLevel = 0;
		ifs[0] = true;
		logMessages = Logger.isActiveLevel(Logger.LEVEL_DEBUG);
		if (logMessages) {
			timeBegin = System.currentTimeMillis();
			viewer.scriptStatus("Eval.instructionDispatchLoop():" + timeBegin);
			viewer.scriptStatus(toString());
		}
		if (scriptLevel <= commandHistoryLevelMax)
			viewer.addCommand(script);
		while (pc < aatoken.length) {
			if (!checkContinue())
				break;
			Token token = aatoken[pc][0];
			// if (token.tok == Token.load)
			// viewer.getSetHistory(-2); //just clear -- no, this is very useful
			statement = aatoken[pc++];
			statementLength = statement.length;
			if (logMessages)
				logDebugScript();
			Logger.debug(token.toString());
			if (ifLevel > 0 && !ifs[ifLevel] && token.tok != Token.endifcmd && token.tok != Token.ifcmd
					&& token.tok != Token.elsecmd)
				continue;
			switch (token.tok) {
			case Token.ifcmd:
				if (++ifLevel == MAX_IF_DEPTH)
					evalError(GT._("Too many nested {0} commands", "IF"));
				ifs[ifLevel] = (ifs[ifLevel - 1] && ifCmd());
				break;
			case Token.elsecmd:
				if (ifLevel < 1)
					evalError(GT._("Invalid {0} command", "ELSE"));
				ifs[ifLevel] = !ifs[ifLevel];
				break;
			case Token.endifcmd:
				if (--ifLevel < 0)
					evalError(GT._("Invalid {0} command", "ENDIF"));
				break;
			case Token.backbone:
				proteinShape(JmolConstants.SHAPE_BACKBONE);
				break;
			case Token.background:
				background();
				break;
			case Token.center:
				center(1);
				break;
			case Token.color:
				color();
				break;
			case Token.data:
				data();
				break;
			case Token.define:
				define();
				break;
			case Token.echo:
				echo();
				break;
			case Token.message:
				message();
				break;
			case Token.exit: // flush the queue and...
				if (pc > 1)
					viewer.clearScriptQueue();
			case Token.quit: // quit this only if it isn't the first command
				interruptExecution = ((pc > 1 || !viewer.usingScriptQueue()) ? Boolean.TRUE : Boolean.FALSE);
				break;
			case Token.label:
				label();
				break;
			case Token.hover:
				hover();
				break;
			case Token.load:
				load();
				break;
			case Token.monitor:
				monitor();
				break;
			case Token.refresh:
				refresh();
				break;
			case Token.initialize:
				initialize();
				break;
			case Token.reset:
				reset();
				break;
			case Token.rotate:
				rotate(false);
				break;
			case Token.script:
				script();
				break;
			case Token.history:
				history(1);
				break;
			case Token.select:
				select();
				break;
			case Token.translate:
				translate();
				break;
			case Token.translateSelected:
				translateSelected();
				break;
			case Token.zap:
				zap();
				break;
			case Token.zoom:
				zoom(false);
				break;
			case Token.zoomTo:
				zoom(true);
				break;
			case Token.delay:
				delay();
				break;
			case Token.loop:
				delay(); // a loop is just a delay followed by ...
				pc = 0; // ... resetting the program counter
				break;
			case Token.move:
				move();
				break;
			case Token.display:
				display();
				break;
			case Token.hide:
				hide();
				break;
			case Token.restrict:
				restrict();
				break;
			case Token.subset:
				subset();
				break;
			case Token.selectionHalo:
				setSelectionHalo(1);
				break;
			case Token.set:
				set();
				break;
			case Token.slab:
				slab();
				break;
			case Token.depth:
				depth();
				break;
			case Token.star:
				star();
				break;
			case Token.halo:
				halo();
				break;
			case Token.cpk:
				spacefill();
				break;
			case Token.wireframe:
				wireframe();
				break;
			case Token.vector:
				vector();
				break;
			case Token.dipole:
				dipole();
				break;
			case Token.animation:
				animation();
				break;
			case Token.vibration:
				vibration();
				break;
			case Token.calculate:
				calculate();
				break;
			case Token.dots:
				dots(1, Dots.DOTS_MODE_DOTS);
				break;
			case Token.strands:
				proteinShape(JmolConstants.SHAPE_STRANDS);
				break;
			case Token.meshRibbon:
				proteinShape(JmolConstants.SHAPE_MESHRIBBON);
				break;
			case Token.ribbon:
				proteinShape(JmolConstants.SHAPE_RIBBONS);
				break;
			case Token.trace:
				proteinShape(JmolConstants.SHAPE_TRACE);
				break;
			case Token.cartoon:
				proteinShape(JmolConstants.SHAPE_CARTOON);
				break;
			case Token.rocket:
				proteinShape(JmolConstants.SHAPE_ROCKETS);
				break;
			case Token.spin:
				rotate(true);
				break;
			case Token.ssbond:
				ssbond();
				break;
			case Token.hbond:
				hbond(true);
				break;
			case Token.show:
				show();
				break;
			case Token.frame:
				frame(1, false);
				break;
			case Token.model:
				frame(1, true);
				break;
			case Token.font:
				font();
				break;
			case Token.moveto:
				moveto();
				break;
			case Token.bondorder:
				bondorder();
				break;
			case Token.console:
				console();
				break;
			case Token.pmesh:
				pmesh();
				break;
			case Token.draw:
				draw();
				break;
			case Token.polyhedra:
				polyhedra();
				break;
			case Token.geosurface:
				dots(1, Dots.DOTS_MODE_SURFACE);
				break;
			case Token.centerAt:
				centerAt();
				break;
			case Token.isosurface:
				isosurface(JmolConstants.SHAPE_ISOSURFACE);
				break;
			case Token.lcaocartoon:
				lcaoCartoon();
				break;
			case Token.mo:
				mo();
				break;
			case Token.stereo:
				stereo();
				break;
			case Token.connect:
				connect();
				break;
			case Token.getproperty:
				getProperty();
				break;
			case Token.configuration:
				configuration();
				break;
			case Token.axes:
				setAxes(1);
				break;
			case Token.boundbox:
				setBoundbox(1);
				break;
			case Token.unitcell:
				setUnitcell(1);
				break;
			case Token.frank:
				setFrank(1);
				break;
			case Token.help:
				help();
				break;
			case Token.save:
				save();
				break;
			case Token.restore:
				restore();
				break;
			case Token.write:
				write();
				break;
			case Token.pause: // resume is done differently
				pauseExecution();
				break;

			// not implemented
			case Token.structure:
			case Token.bond:
			case Token.clipboard:
			case Token.molecule:
			case Token.print:
			case Token.renumber:
			case Token.unbond:
				// chime extended commands
			case Token.view:
			case Token.list:
			case Token.display3d:
				viewer.scriptStatus("script ERROR: command not implemented:" + token.value);
				break;
			default:
				unrecognizedCommand(token);
				return;
			}
		}
	}