Update code for logout function