Switched from setImmediate to setInterval