refactors embed into factory