I think this fixes the redirect bug. There may be
further simplification.
More simplification of redirect flow.