Update main.py

some improvements in rotation and errors handling