Use setImmediate instead of deprecated call to process.nextTick.