Added _merge_memory_block function