Clean up, support all redirects, fix potential endless 401 loop.