Rewriting applicative code to use the retain stack instead of named values
