Added basic implementation of merging nodes