More logging, better error handling.