Cleaaning up the auto upload code, removing print statements and adding
some logging.