merge method optimized