Merge local modifications with incoming modifications

Tests and implementation for #67