Refactor embed_code