refactor check command