UPDATE and write main function for main.py