updated to use a class, saved original version as quickAndDirty