encoding and merging #189

@Riham-Gamal