logging for refunds

...and some flake8 cleaning