addCommand refactoring.