Merge duplicate merge_block functions into one