Added largely unmodified main.py.