Moved out logic.
Initial implementation of file merging.