save function for reg class