extract copy map to a separate function