extracted some of the logic in ConsoleCommander

s