adding redirecting logic