factored out IndexMap