Updated backup function