Use setInterval instead of recursive setTimeout