seperate code into a class