Update main.py

Update on restore function. Still ongoing.