More work on the redirect logic