use setInterval instead of setTimeout