logout function implemented