Finish the logic of file.