No global variables. easily fixed.

Everything is put into a function that is invoked.