refactor Command class