Fix clearTimeout recursion bug
Clean code and comment