adding early version using class. Still needs lots of work