Refactored media_file factory