Updated with many more comments, some extended help, a command-prompt indicator, and a separate main() and command loop() function.