Finished refactoring, so it works again. Added command-line options to
set port and print version number.