CMD refactor