The problem with the last version was fixed by processing the "src" and "tgt" keys first, and then processing the rest.