Changes to redirect code