added a redirect function