Refactored functionality from JavaScriptEngine class up into IScriptEngine base class.