Merge(This contains code for diagnostics)