Logout function changed