Refactored to use a decoupled ScriptReader.