added support for redirects