Making a better use of exec