Refactor using command