Remove old code
Handle logging.Logger as log, improve docstring, add retry loop