Turn nextTick into setImmediate - prevents stack overflows