added index-storing to forall