Use indexing generic code instead of tdb private funtions