Replaced setTimeout with setInterval