Please move all of this into a function named `main`.

(Note that earlier I had suggested everything below this being in a `if __name__ == '__main__' block` -- let's go a slightly different direction instead).