refactoring the launcher script