rewrite main.py