refactor embed js