refactoring consoleCommand