cleaner version of get_prim()