 		
 		/**
 		 * @param tokens
-		 * @param start
+		 * @param start first index to check
 		 * @return index of next statement
 		 */		
 		private function findNextStatement(tokens:Array, start:int):int
 		{
-			while (++start < tokens.length)
+			for (; start < tokens.length; start++)
+			{
 				if (statements.hasOwnProperty(tokens[start]))
 					break;
+			}
 			return start;
 		}
 		
 		/**
-		 * This function assumes that bracket operators have already been compiled.
+		 * This function assumes that every token except statements have already been compiled.
+		 * @param tokens
+		 * @param startIndex The index of the first token to compile
 		 */
-		private function compileStatements(tokens:Array):void
-		{
-			var i:int = -1;
+		private function compileStatements(tokens:Array, startIndex:int = 0):void
+		{
+			var i:int;
 			var j:int;
-			while (true)
-			{
-				switch (tokens[i = findNextStatement(tokens, i)])
-				{
-					case STATEMENT_IF:
+			var stmt:String;
+			
+			if (startIndex == 0)
+			{
+				// verify that everything except statements have been compiled and that statements have the correct number of parameters
+				for (i = 0; i < tokens.length; i++)
+				{
+					if (tokens[i] is ICompiledObject)
+					{
+						// ok
+					}
+					else if (statements.hasOwnProperty(tokens[i]))
+					{
 						assertValidStatementParams(tokens, i);
-						switch (tokens[j = findNextStatement(tokens, i)])
-						{
-							case STATEMENT_ELSE:
-							default:
-						}
-						break;
-					default:
-						return;
-				}
-			}
-			
-			
-			
-			
+					}
+					else
+						throw new Error("Unexpected token: " + tokens[i]);
+				}
+			}
+			
+			i = findNextStatement(tokens, startIndex);
+			
+			// stop when there are no statements
+			if (i >= tokens.length)
+				return;
+			
+			if (statements[tokens[i]]) // requires params.  Example:  if () {}
+			{
+				compileStatements(tokens, i + 2);
+			}
+			else // no params.  Example:  else {}
+			{
+				compileStatements(tokens, i + 1);
+			}
+			
+			// now everything to the right of the current statement and its params have been taken care of.
+			
+			
+			
+			switch (tokens[i])
+			{
+				case STATEMENT_FOR: // for () {}
+				case STATEMENT_WHILE: // while () {}
+				case STATEMENT_IF: // if () {} else {}
+				case STATEMENT_ELSE: // else {}
+				case STATEMENT_EACH: // for each () {}
+				case STATEMENT_DO: // do {} while ()
+				case STATEMENT_RETURN: // return EXPR
+				case STATEMENT_BREAK: // break
+				case STATEMENT_CONTINUE: // continue
+				case STATEMENT_SWITCH: // switch () {}
+				case STATEMENT_CASE: // case EXPR :
+				case STATEMENT_DEFAULT: // default :
+				case STATEMENT_THROW: // throw EXPR
+				case STATEMENT_TRY: // try {} catch () {} finally {}
+				case STATEMENT_CATCH: // catch () {}
+				case STATEMENT_FINALLY: // finally {}
+				default:
+					return;
+			}
 		}
 		private function compileStatements1(tokens:Array):void
 		{

				
				if (cfc.evaluatedMethod is String) // variable lookup
				{
					compiledTokens.splice(--i, 2, compileOperator('#' + op, [cfc.compiledMethod, new CompiledConstant("1", 1)]));
					continue;
				}
				else if (cfc.evaluatedMethod == operators['.'])
				{
					// switch to the postfix operator
					cfc.compiledParams.push(new CompiledConstant("1", 1));
					compiledTokens.splice(--i, 2, compileOperator('#' + op, cfc.compiledParams));
					continue;
				}

			if (operators.hasOwnProperty('#'))
				compileUnaryOperators(tokens, ['#']);
			
			compilePostfixOperators(tokens, ['--', '++']);
			
			// next step: compile infix '**' operators
