Using process.nextTick instead of setImmediate