Reworked command-line parameters, added graceful shutdown code, added prod support.