Finds the right way to logout