Consolidate some helper routines.