stuck the stuff from if __name__=__main__ into main()