Moving anonymous / clear login to separate function