Refactoring: move the model launching code to functions