implemented the restore function and reshaped google auth handling.