Refactor sub commands