Refactored generated code for initialize and added argument exceptions in raw script run.