change setInterval to explicit setTimeout