the revised version of main.py