reduced code to classes and objects

There is a lot more to do, I am having issues with previous code where I
cannot use instance variables, but am forced to use globals