modified main.py simplified the code