Updated redir parsing (HAS A MEMORY LEAK)