added a logout function