Cleaned up main.py so it's easy to read through and understand (self-documented)