rejigged the executable part of the program to use the python 'main' idiom