M: ScriptFile: refactoring + several changes.