This code is duplicated.  Could you re-arrange the if statement so the same recover() block is used for both cases?