refactored backup logic into separate class