Adding Logic for recovery