Modification to redirection function