Update main.py

Cleaned up the code that "renders" frames and removed other unnecessary code. Added some comments to clarify some things too.