refactor ScriptConstructor to IScriptFactory
refactor FormatTemplate constants, add comments