used the Cmd module to replace the original command line loop, it gives ...

...you a nice command history that is just an up arrow away. Also changed tabs to spaces to be pep-8 compliant.