Refactors redirect