Fixed a bunch of problems with main.py