Optimize embed functions