logout and history revised