implemented hierarchy updates on merging