Split up part of dcp.c into common.c