appendCompartments function

Append compartments.