Updated logout functionality