refactoring exec command