refactor + exit setTimeout