replace indexer by generic callback