Add --quiet, --verbose, and --debug flags

Also add some comments in the code where necessary.