Changed redirect() function