MediaEmbed: reorganized some code