Rewrite to use new mega_file object.