refactoring "create script" model code