Remove query helper functions. Clean up cm_rels function usage