Simplified element_index implementation