adding some if loops for redirects