Added automatic redirects if not logged in