Moved logout check to core