created redirect function