adding merge logic