Updated script processor implementation to use a stream