Simplify main; extract to Controller.exec_cmdloop

Also reduce # of flake8 warnings from 54 to 49.
OK, updated.