The meat of the logic, for keeping multiple node_cache paths.  Check carefully (but in the end, it's simple)