Add variable expansion support to recover function