rewriting over index