Refactoring the backup target logic.