move code into a class