changed setInterval to setTimeout