Update main.py

completed first shot at the complete program. Now needs testing.