Added further checks to ensure a user is at least logged in for almost everything.