pep8 + improved history & logging.