Update main.py

Reduce redundancy