Consolidate common logic