Added in_place option to merge_nodes

This is in relation to the discussion that happaned in #1100. After this is merged, I will make the appropriate changes in #1100 


I suggest we write a function, `new_id`, or `next_id`. That way, if it turns out that max was a terrible idea (=P), we can easily change how we get new IDs.