move the restore config / payload generation to a class

(prefactoring - this is literally just moving the function to the class and reinitializing the variables)