Added a logout function