Rework SAMR functions to avoid gendb_search()