Rewrite Package-Merge code yet again