Added if logged in checks and logout feature