EZP-21045: deduplicated code