Logout function update