Refactor report.py