encoding and merging #189