Refactoring command execution