don't use maps to store indices, compute them on the fly