cleaned up logout sequence