Adding check for isloggedin