implemented logout function (ui not done yet)