updated logout functionality