public Script(Config config, Helper helper, boolean doOverride) throws ApplicationException {
		try {
			this.context = ContextFactory.getGlobal().enterContext();
			context.setOptimizationLevel(RHINO_OPTIMIZATION_LEVEL);
			this.scope = new ImporterTopLevel(context);

			scope.put("helper", scope, helper); //$NON-NLS-1$
			scope.put(Config.VAR_PARAM_0, scope, config.getParam0());
			scope.put(Config.VAR_PARAM_1, scope, config.getParam1());
			scope.put(Config.VAR_PARAM_2, scope, config.getParam2());
			scope.put(Config.VAR_PARAM_3, scope, config.getParam3());
			scope.put(Config.VAR_PARAM_4, scope, config.getParam4());
			scope.put(Config.VAR_PARAM_5, scope, config.getParam5());
			scope.put(Config.VAR_PARAM_6, scope, config.getParam6());
			scope.put(Config.VAR_PARAM_7, scope, config.getParam7());
			scope.put(Config.VAR_PARAM_8, scope, config.getParam8());
			scope.put(Config.VAR_PARAM_9, scope, config.getParam9());

			context.evaluateString(scope, config.getHelperScript(), Config.HELPER_FILENAME, 1, null);

			context.evaluateString(scope, config.getScenarioScript(), config.getScriptFilename(),
					1, null);

			Object variable = null;

			variable = scope.get("init", scope); //$NON-NLS-1$

			if (variable instanceof Function) {
				this.initFunction = (Function) variable;
			} else {
				this.initFunction = null;
			}

			variable = scope.get("run", scope); //$NON-NLS-1$

			if (variable instanceof Function) {
				this.runFunction = (Function) variable;
			} else {
				this.runFunction = null;
			}

			variable = scope.get("fin", scope); //$NON-NLS-1$

			if (variable instanceof Function) {
				this.finFunction = (Function) variable;
			} else {
				this.finFunction = null;
			}

			if (doOverride) {
				scope.put(Config.VAR_JDBC_DRIVER, scope, config.getJdbcDriver());
				scope.put(Config.VAR_JDBC_URL, scope, config.getJdbcUrl());
				scope.put(Config.VAR_JDBC_USER, scope, config.getJdbcUser());
				scope.put(Config.VAR_JDBC_PASS, scope, config.getJdbcPass());
				scope.put(Config.VAR_LOAD, scope, config.isLoad());
				scope.put(Config.VAR_WARMUP_TIME, scope, config.getWarmupTime());
				scope.put(Config.VAR_MEASUREMENT_TIME, scope, config.getMeasurementTime());
				scope.put(Config.VAR_N_TX_TYPES, scope, config.getNTxTypes());
				scope.put(Config.VAR_N_AGENTS, scope, config.getNAgents());
				scope.put(Config.VAR_CONN_POOL_SIZE, scope, config.getConnPoolSize());
				scope.put(Config.VAR_STMT_CACHE_SIZE, scope, config.getStmtCacheSize());
				scope.put(Config.VAR_AUTO_COMMIT, scope, config.isAutoCommit());

				if (config.getNTxTypes() == 1) {
					scope.put(Config.VAR_SLEEP_TIME, scope, config.getSleepTime(0));
					scope.put(Config.VAR_THROTTLE, scope, config.getThrottle(0));
				} else {
					NativeArray sleepTimeArray = (NativeArray) context.newArray(scope,
							config.getNTxTypes());

					NativeArray throttleArray = (NativeArray) context.newArray(scope,
							config.getNTxTypes());

					for (int txType = 0; txType < config.getNTxTypes(); txType++) {
						sleepTimeArray.put(txType, sleepTimeArray, config.getSleepTime(txType));
						throttleArray.put(txType, throttleArray, config.getThrottle(txType));
					}

					scope.put(Config.VAR_SLEEP_TIME, scope, sleepTimeArray);
					scope.put(Config.VAR_THROTTLE, scope, throttleArray);
				}

				scope.put(Config.VAR_DEBUG, scope, config.isDebug());
				scope.put(Config.VAR_TRACE, scope, config.isTrace());
				scope.put(Config.VAR_LOG_DIR, scope, config.getLogDir());
			}
		} catch (WrappedException e) {
			Throwable we = e.getWrappedException();

			throw new ApplicationException(Resources.getString("Script.WRAPPED_EXCEPTION") //$NON-NLS-1$
					+ SEPARATOR + we.toString() + SEPARATOR + e.getScriptStackTrace(), e);
		} catch (EvaluatorException e) {
			throw new ApplicationException(Resources.getString("Script.EVALUATOR_EXCEPTION") //$NON-NLS-1$
					+ SEPARATOR + e.getMessage() + SEPARATOR + e.lineSource(), e);
		} catch (RhinoException e) {
			throw new ApplicationException(Resources.getString("Script.RHINO_EXCEPTION") //$NON-NLS-1$
					+ SEPARATOR + e.getMessage() + SEPARATOR + e.getScriptStackTrace(), e);
		}
	}