Updated FactorEm to include row indices