Merge middleware