made the redirect more dynamic