simplify redirection code