Working, with subtle extras for error reporting and remembering dirs.