Update main.py

Added many comments in the code.