Change code structure to use python [cmd](https://docs.python.org/3/library/cmd.html#cmd.Cmd.cmdloop) library?