Add destinationMap and factorize code