is it right that you are changing the original mesh here? maybe alternative way is to use a vector of new id for old nodes without touching the original. but i don't know which is better at the moment.