refactor using commander