Updated embedding function.