Using process.nextTick instead of setTimeout(function(){}, 1)