almost done moving all code into its own class