Redirect fixes

This PR allows us to redirect out of a modal properly, and removes some redundant code.