Made reverse algorithm variant-aware.

[SVN r86678]