starting to restructure code for class usage