Implemented logout functionality