Finish the logic of metafile