Implemented the core of the merge-file and per-dir merge-file support