refactor terminal launch