Added 'IsLoggedIn' function.