Adjust exemple with settimeout to prevent freeze