Lots of logging, and fix unset input_dir in main().