changed merge logic