Add better support for redirects