Refactored into a class.  Everything is working the way it was before the refactor