Implement log out function