Fix potential reference before assignment
Trim empty lines
Fix linter issues
Additional comments
Fix bug #2: Treatment of abandoned scans