moved everything into a class