opitimize logout