added some extra code that I researched online that supposedly is the best way to logout