index_fd(): split into two helper functions