First patch to resolve #1235. We need more implementation for handling node removals,
and I'll implement in next patch.