Moved redirection out of if