using setInterval instead of setTimeout