Index: applications/editors/josm/plugins/conflation/src/org/openstreetmap/josm/plugins/conflation/ConflationLayer.java
===================================================================
--- applications/editors/josm/plugins/conflation/src/org/openstreetmap/josm/plugins/conflation/ConflationLayer.java	(revision 26023)
+++ applications/editors/josm/plugins/conflation/src/org/openstreetmap/josm/plugins/conflation/ConflationLayer.java	(revision 27742)
@@ -12,10 +12,11 @@
 import java.awt.Point;
 import java.awt.geom.GeneralPath;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
 import org.openstreetmap.josm.actions.RenameLayerAction;
 
 
 import org.openstreetmap.josm.data.Bounds;
-import org.openstreetmap.josm.data.conflict.Conflict;
-import org.openstreetmap.josm.data.conflict.ConflictCollection;
 import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.data.osm.Node;
@@ -27,5 +28,5 @@
 import org.openstreetmap.josm.gui.layer.Layer;
 import org.openstreetmap.josm.gui.layer.Layer.SeparatorLayerAction;
-import org.openstreetmap.josm.gui.layer.OsmDataLayer;
+import org.openstreetmap.josm.plugins.conflation.ConflationOptionsPanel.ConflationCandidate;
 import org.openstreetmap.josm.tools.ImageProvider;
 
@@ -35,13 +36,12 @@
  * @author Josh Doe <josh@joshdoe.com>
  */
-public class ConflationLayer extends OsmDataLayer implements LayerChangeListener {
-    // TODO: this really shouldn't be OsmDataLayer, but easy to use conflict dialog
-
-    ConflictCollection conflicts;
-
-    public ConflationLayer(DataSet ds, ConflictCollection conflicts) {
-        super(ds, tr("Conflation symbols"), null);
+public class ConflationLayer extends Layer implements LayerChangeListener {
+    protected List<ConflationCandidate> candidates;
+    protected ConflationCandidate selectedCandidate = null;
+    
+    public ConflationLayer(DataSet ds, List<ConflationCandidate> candidates) {
+        super(tr("Conflation"));
         MapView.addLayerChangeListener(this);
-        this.conflicts = conflicts;
+        this.candidates = candidates;
     }
 
@@ -54,20 +54,23 @@
         Graphics2D g2 = g;
         BasicStroke line = new BasicStroke(3, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);
-        g2.setColor(Color.blue);
         g2.setStroke(line);
-
-        GeneralPath path = new GeneralPath();
 
         final double PHI = Math.toRadians(20);
         final double cosPHI = Math.cos(PHI);
         final double sinPHI = Math.sin(PHI);
-
-        for (Conflict c : conflicts) {
-            OsmPrimitive p = c.getMy();
-            OsmPrimitive q = c.getTheir();
-            if (p != null && q != null) {
+        for (Iterator<ConflationCandidate> it = this.candidates.iterator(); it.hasNext();) {
+            ConflationCandidate candidate = it.next();
+            if (candidate.equals(selectedCandidate)) {
+                g2.setColor(Color.blue);
+            } else {
+                g2.setColor(Color.cyan);
+            }
+            OsmPrimitive src = candidate.getSource();
+            OsmPrimitive tgt = candidate.getTarget();
+            if (src != null && tgt != null) {
+                GeneralPath path = new GeneralPath();
                 // we have a pair, so draw line between them, FIXME: not good to use getCenter() from here, move to utils?
-                Point p1 = mv.getPoint(ConflationOptionsPanel.getCenter(p));
-                Point p2 = mv.getPoint(ConflationOptionsPanel.getCenter(q));
+                Point p1 = mv.getPoint(ConflationOptionsPanel.getCenter(src));
+                Point p2 = mv.getPoint(ConflationOptionsPanel.getCenter(tgt));
                 path.moveTo(p1.x, p1.y);
                 path.lineTo(p2.x, p2.y);
@@ -88,10 +91,9 @@
                     }
                 }
+                g2.draw(path);
             }
-            // TODO: handle other than just Node->Node cases
-            // TODO: draw color coded circle around unmatched nodes
         }
 
-        g2.draw(path);
+        
     }
 
@@ -120,12 +122,12 @@
     @Override
     public void visitBoundingBox(BoundingXYVisitor v) {
-        //TODO: handle Way/Relation types
-        for (Conflict c : conflicts) {
-            OsmPrimitive my = c.getMy();
-            OsmPrimitive their = c.getTheir();
-            if (my != null && my instanceof Node)
-                v.visit((Node)my);
-            if (their != null && their instanceof Node)
-                v.visit((Node)their);
+        for (Iterator<ConflationCandidate> it = this.candidates.iterator(); it.hasNext();) {
+            ConflationCandidate candidate = it.next();
+            OsmPrimitive src = candidate.getSource();
+            OsmPrimitive tgt = candidate.getTarget();
+            if (src != null && src instanceof Node)
+                v.visit((Node)src);
+            if (tgt != null && tgt instanceof Node)
+                v.visit((Node)tgt);
         }
     }
@@ -164,6 +166,10 @@
      * @return the set of conflicts currently managed in this layer
      */
-    public ConflictCollection getConflicts() {
-        return conflicts;
+    public List<ConflationCandidate> getCandidates() {
+        return this.candidates;
+    }
+    
+    public void setSelectedCandidate(ConflationCandidate c) {
+        selectedCandidate = c;
     }
 }
Index: applications/editors/josm/plugins/conflation/src/org/openstreetmap/josm/plugins/conflation/ConflationOptionsPanel.form
===================================================================
--- applications/editors/josm/plugins/conflation/src/org/openstreetmap/josm/plugins/conflation/ConflationOptionsPanel.form	(revision 26023)
+++ applications/editors/josm/plugins/conflation/src/org/openstreetmap/josm/plugins/conflation/ConflationOptionsPanel.form	(revision 27742)
@@ -1,3 +1,3 @@
-<?xml version="1.1" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8" ?>
 
 <Form version="1.6" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
@@ -69,5 +69,5 @@
                 <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
                   <Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
-                    <TitledBorder title="My Set"/>
+                    <TitledBorder title="Target Selection"/>
                   </Border>
                 </Property>
@@ -144,5 +144,5 @@
                   </Properties>
                   <Events>
-                    <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="freezeMySetButtonActionPerformed"/>
+                    <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="freezeTargetSelectionActionPerformed"/>
                   </Events>
                 </Component>
@@ -201,5 +201,5 @@
                 <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
                   <Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
-                    <TitledBorder title="Their Set"/>
+                    <TitledBorder title="Source Selection"/>
                   </Border>
                 </Property>
@@ -276,5 +276,5 @@
                   </Properties>
                   <Events>
-                    <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="freezeTheirSelectionButtonActionPerformed"/>
+                    <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="freezeSourceSelectionActionPerformed"/>
                   </Events>
                 </Component>
@@ -360,13 +360,17 @@
             <DimensionLayout dim="0">
               <Group type="103" groupAlignment="0" attributes="0">
-                  <Group type="102" alignment="1" attributes="0">
-                      <EmptySpace pref="578" max="32767" attributes="0"/>
-                      <Component id="criteriaTabConflateButton" min="-2" max="-2" attributes="0"/>
-                      <EmptySpace max="-2" attributes="0"/>
-                  </Group>
-                  <Group type="102" alignment="0" attributes="0">
-                      <EmptySpace max="-2" attributes="0"/>
-                      <Component id="jPanel2" min="-2" max="-2" attributes="0"/>
-                      <EmptySpace pref="292" max="32767" attributes="0"/>
+                  <Group type="102" attributes="0">
+                      <EmptySpace max="-2" attributes="0"/>
+                      <Group type="103" groupAlignment="0" attributes="0">
+                          <Group type="102" alignment="1" attributes="0">
+                              <EmptySpace min="0" pref="568" max="32767" attributes="0"/>
+                              <Component id="criteriaTabConflateButton" min="-2" max="-2" attributes="0"/>
+                          </Group>
+                          <Group type="102" alignment="0" attributes="0">
+                              <Component id="jPanel2" min="-2" max="-2" attributes="0"/>
+                              <EmptySpace min="0" pref="282" max="32767" attributes="0"/>
+                          </Group>
+                      </Group>
+                      <EmptySpace max="-2" attributes="0"/>
                   </Group>
               </Group>
@@ -491,10 +495,10 @@
                           <Component id="jLabel8" min="-2" max="-2" attributes="0"/>
                           <EmptySpace type="unrelated" max="-2" attributes="0"/>
-                          <Component id="useMyTagsButton" min="-2" max="-2" attributes="0"/>
+                          <Component id="replaceGeometryButton" min="-2" max="-2" attributes="0"/>
                           <EmptySpace type="unrelated" max="-2" attributes="0"/>
                           <Component id="useTheirTagsButton" min="-2" max="-2" attributes="0"/>
                           <EmptySpace type="unrelated" max="-2" attributes="0"/>
                           <Component id="jButton1" min="-2" max="-2" attributes="0"/>
-                          <EmptySpace pref="300" max="32767" attributes="0"/>
+                          <EmptySpace pref="252" max="32767" attributes="0"/>
                       </Group>
                   </Group>
@@ -506,5 +510,5 @@
                           <Group type="103" groupAlignment="3" attributes="0">
                               <Component id="jLabel8" alignment="3" min="-2" max="-2" attributes="0"/>
-                              <Component id="useMyTagsButton" alignment="3" min="-2" max="-2" attributes="0"/>
+                              <Component id="replaceGeometryButton" alignment="3" min="-2" max="-2" attributes="0"/>
                               <Component id="useTheirTagsButton" alignment="3" min="-2" max="-2" attributes="0"/>
                               <Component id="jButton1" alignment="3" min="-2" max="-2" attributes="0"/>
@@ -516,10 +520,10 @@
               </Layout>
               <SubComponents>
-                <Component class="javax.swing.JButton" name="useMyTagsButton">
-                  <Properties>
-                    <Property name="text" type="java.lang.String" value="My Tags"/>
+                <Component class="javax.swing.JButton" name="replaceGeometryButton">
+                  <Properties>
+                    <Property name="text" type="java.lang.String" value="Replace Geometry"/>
                   </Properties>
                   <Events>
-                    <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="useMyTagsButtonActionPerformed"/>
+                    <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="replaceGeometryButtonActionPerformed"/>
                   </Events>
                 </Component>
@@ -541,24 +545,4 @@
                 </Component>
               </SubComponents>
-            </Container>
-            <Container class="javax.swing.JPanel" name="tagMergerPlaceholderPanel">
-              <Properties>
-                <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
-                  <Dimension value="[661, 250]"/>
-                </Property>
-              </Properties>
-
-              <Layout>
-                <DimensionLayout dim="0">
-                  <Group type="103" groupAlignment="0" attributes="0">
-                      <EmptySpace min="0" pref="661" max="32767" attributes="0"/>
-                  </Group>
-                </DimensionLayout>
-                <DimensionLayout dim="1">
-                  <Group type="103" groupAlignment="0" attributes="0">
-                      <EmptySpace min="0" pref="150" max="32767" attributes="0"/>
-                  </Group>
-                </DimensionLayout>
-              </Layout>
             </Container>
             <Component class="javax.swing.JButton" name="resolveButton">
Index: applications/editors/josm/plugins/conflation/src/org/openstreetmap/josm/plugins/conflation/ConflationOptionsPanel.java
===================================================================
--- applications/editors/josm/plugins/conflation/src/org/openstreetmap/josm/plugins/conflation/ConflationOptionsPanel.java	(revision 26023)
+++ applications/editors/josm/plugins/conflation/src/org/openstreetmap/josm/plugins/conflation/ConflationOptionsPanel.java	(revision 27742)
@@ -10,9 +10,5 @@
 
 import java.awt.Component;
-import java.util.ArrayList;
-import java.util.HashSet;
-
-import java.util.List;
-import java.util.Set;
+import java.util.*;
 import javax.swing.DefaultListCellRenderer;
 import javax.swing.Icon;
@@ -30,5 +26,4 @@
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.command.Command;
-import org.openstreetmap.josm.data.conflict.Conflict;
 import org.openstreetmap.josm.data.conflict.ConflictCollection;
 import org.openstreetmap.josm.data.conflict.IConflictListener;
@@ -39,7 +34,8 @@
 import org.openstreetmap.josm.data.osm.TagCollection;
 import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
-import org.openstreetmap.josm.gui.conflict.pair.ConflictResolver;
 import org.openstreetmap.josm.gui.layer.Layer;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
+
+import org.openstreetmap.josm.plugins.conflation.ConflationUtils.*;
 
 /**
@@ -50,15 +46,12 @@
     ConflationOptionsDialog dlg = null;
     ConflationLayer conflationLayer = null;
-    DataSet myDataSet = null;
-    DataSet theirDataSet = null;
-    ArrayList<OsmPrimitive> mySelection = null;
+    DataSet targetDataSet = null;
+    DataSet sourceDataSet = null;
+    ArrayList<OsmPrimitive> targetSelection = null;
     ArrayList<OsmPrimitive> theirSelection = null;
-    OsmDataLayer myLayer = null;
+    OsmDataLayer targetLayer = null;
     OsmDataLayer theirLayer = null;
-    ConflictCollection conflicts = null;
-    ConflictResolver conflictResolver;
-    OsmPrimitive[][] pairs;
-    int[][] assignment;
     MatchTableModel tableModel;
+    List<ConflationCandidate> candidates = null;
 
     /** Creates new form ConflationPanel */
@@ -66,5 +59,5 @@
         initComponents();
 
-        // add selection handler, to change ConflictResolver contents and center/zoom view
+        // add selection handler, to center/zoom view
         resultsTable.getSelectionModel().addListSelectionListener(
                 new MatchListSelectionHandler());
@@ -76,18 +69,5 @@
         resultsTable.getColumnModel().getColumn(4).setCellRenderer(cr);
 
-        // replace dummy panel with conflictResolver
-        conflictResolver = new ConflictResolver();
-        for (int i = 0; i < resultsPanel.getComponentCount(); i++) {
-            if (resultsPanel.getComponent(i) == tagMergerPlaceholderPanel) {
-                resultsPanel.add(conflictResolver, i);
-                resultsPanel.remove(tagMergerPlaceholderPanel);
-                break;
-            }
-        }
-        resultsPanel.validate();
-
         this.dlg = dlg;
-
-        conflicts = new ConflictCollection();
 
         // set layer names to comboboxes
@@ -144,19 +124,18 @@
         resultsTable = new javax.swing.JTable();
         jPanel1 = new javax.swing.JPanel();
-        useMyTagsButton = new javax.swing.JButton();
+        replaceGeometryButton = new javax.swing.JButton();
         jLabel8 = new javax.swing.JLabel();
         useTheirTagsButton = new javax.swing.JButton();
         jButton1 = new javax.swing.JButton();
-        tagMergerPlaceholderPanel = new javax.swing.JPanel();
         resolveButton = new javax.swing.JButton();
 
         setLayout(new javax.swing.BoxLayout(this, javax.swing.BoxLayout.LINE_AXIS));
 
-        refSetPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("My Set"));
+        refSetPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Target Selection"));
 
         freezeMySetButton.setText("Freeze Selection");
         freezeMySetButton.addActionListener(new java.awt.event.ActionListener() {
             public void actionPerformed(java.awt.event.ActionEvent evt) {
-                freezeMySetButtonActionPerformed(evt);
+                freezeTargetSelectionActionPerformed(evt);
             }
         });
@@ -194,5 +173,5 @@
                     .addGroup(refSetPanelLayout.createSequentialGroup()
                         .addComponent(freezeMySetButton)
-                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 387, Short.MAX_VALUE)
+                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 392, Short.MAX_VALUE)
                         .addComponent(restoreMySetButton))
                     .addGroup(refSetPanelLayout.createSequentialGroup()
@@ -236,10 +215,10 @@
         );
 
-        nonRefSetPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Their Set"));
+        nonRefSetPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Source Selection"));
 
         freezeTheirSelectionButton.setText("Freeze Selection");
         freezeTheirSelectionButton.addActionListener(new java.awt.event.ActionListener() {
             public void actionPerformed(java.awt.event.ActionEvent evt) {
-                freezeTheirSelectionButtonActionPerformed(evt);
+                freezeSourceSelectionActionPerformed(evt);
             }
         });
@@ -277,5 +256,5 @@
                     .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, nonRefSetPanelLayout.createSequentialGroup()
                         .addComponent(freezeTheirSelectionButton)
-                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 387, Short.MAX_VALUE)
+                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 392, Short.MAX_VALUE)
                         .addComponent(restoreTheirSetButton))
                     .addGroup(nonRefSetPanelLayout.createSequentialGroup()
@@ -403,12 +382,14 @@
         criteriaTabPanelLayout.setHorizontalGroup(
             criteriaTabPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
-            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, criteriaTabPanelLayout.createSequentialGroup()
-                .addContainerGap(578, Short.MAX_VALUE)
-                .addComponent(criteriaTabConflateButton)
+            .addGroup(criteriaTabPanelLayout.createSequentialGroup()
+                .addContainerGap()
+                .addGroup(criteriaTabPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, criteriaTabPanelLayout.createSequentialGroup()
+                        .addGap(0, 568, Short.MAX_VALUE)
+                        .addComponent(criteriaTabConflateButton))
+                    .addGroup(criteriaTabPanelLayout.createSequentialGroup()
+                        .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+                        .addGap(0, 282, Short.MAX_VALUE)))
                 .addContainerGap())
-            .addGroup(criteriaTabPanelLayout.createSequentialGroup()
-                .addContainerGap()
-                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
-                .addContainerGap(292, Short.MAX_VALUE))
         );
         criteriaTabPanelLayout.setVerticalGroup(
@@ -444,8 +425,8 @@
         jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());
 
-        useMyTagsButton.setText("My Tags");
-        useMyTagsButton.addActionListener(new java.awt.event.ActionListener() {
-            public void actionPerformed(java.awt.event.ActionEvent evt) {
-                useMyTagsButtonActionPerformed(evt);
+        replaceGeometryButton.setText("Replace Geometry");
+        replaceGeometryButton.addActionListener(new java.awt.event.ActionListener() {
+            public void actionPerformed(java.awt.event.ActionEvent evt) {
+                replaceGeometryButtonActionPerformed(evt);
             }
         });
@@ -466,10 +447,10 @@
                 .addComponent(jLabel8)
                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
-                .addComponent(useMyTagsButton)
+                .addComponent(replaceGeometryButton)
                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                 .addComponent(useTheirTagsButton)
                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                 .addComponent(jButton1)
-                .addContainerGap(300, Short.MAX_VALUE))
+                .addContainerGap(252, Short.MAX_VALUE))
         );
         jPanel1Layout.setVerticalGroup(
@@ -479,5 +460,5 @@
                 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                     .addComponent(jLabel8)
-                    .addComponent(useMyTagsButton)
+                    .addComponent(replaceGeometryButton)
                     .addComponent(useTheirTagsButton)
                     .addComponent(jButton1))
@@ -486,19 +467,4 @@
 
         resultsPanel.add(jPanel1);
-
-        tagMergerPlaceholderPanel.setPreferredSize(new java.awt.Dimension(661, 250));
-
-        javax.swing.GroupLayout tagMergerPlaceholderPanelLayout = new javax.swing.GroupLayout(tagMergerPlaceholderPanel);
-        tagMergerPlaceholderPanel.setLayout(tagMergerPlaceholderPanelLayout);
-        tagMergerPlaceholderPanelLayout.setHorizontalGroup(
-            tagMergerPlaceholderPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
-            .addGap(0, 661, Short.MAX_VALUE)
-        );
-        tagMergerPlaceholderPanelLayout.setVerticalGroup(
-            tagMergerPlaceholderPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
-            .addGap(0, 150, Short.MAX_VALUE)
-        );
-
-        resultsPanel.add(tagMergerPlaceholderPanel);
 
         resolveButton.setText("Resolve");
@@ -523,5 +489,5 @@
 
         // some initialization
-        int n = mySelection.size();
+        int n = targetSelection.size();
         int m = theirSelection.size();
         int maxLen = Math.max(n, m);
@@ -531,27 +497,25 @@
         for (int i = 0; i < n; i++) {
             for (int j = 0; j < m; j++) {
-                cost[i][j] = calcCost(mySelection.get(i), theirSelection.get(j));
+                cost[i][j] = calcCost(targetSelection.get(i), theirSelection.get(j));
             }
         }
 
         // perform assignment using Hungarian algorithm
-        assignment = new int[maxLen][2];
-        assignment = HungarianAlgorithm.hgAlgorithm(cost, "min");
-
-        // create array of primitives based on indices from assignment
-        pairs = new OsmPrimitive[maxLen][2];
+        int[][] assignment = HungarianAlgorithm.hgAlgorithm(cost, "min");
+        OsmPrimitive target, source;
+        candidates = new LinkedList<ConflationCandidate>();
         for (int i = 0; i < maxLen; i++) {
             if (assignment[i][0] < n)
-                pairs[i][0] = mySelection.get(assignment[i][0]);
+                target = targetSelection.get(assignment[i][0]);
             else
-                pairs[i][0] = null;
+                target = null;
             if (assignment[i][1] < m)
-                pairs[i][1] = theirSelection.get(assignment[i][1]);
+                source = theirSelection.get(assignment[i][1]);
             else
-                pairs[i][1] = null;
-
-            if (pairs[i][0] != null && pairs[i][1] != null) {
+                source = null;
+
+            if (target != null && source != null) {
                 // TODO: do something!
-                conflicts.add(pairs[i][0], pairs[i][1]);
+                candidates.add(new ConflationCandidate(source, target));
             }
         }
@@ -559,5 +523,5 @@
         // add conflation layer
         try {
-            conflationLayer = new ConflationLayer(myLayer.data, conflicts);
+            conflationLayer = new ConflationLayer(targetLayer.data, candidates);
             Main.main.addLayer(conflationLayer);
         } catch (Exception ex) {
@@ -568,5 +532,4 @@
         resultsTable.setModel(tableModel);
 
-        conflictResolver.populate(conflicts.get(0));
         // print list of matched pairsalong with distance
         // upon selection of one pair, highlight them and draw arrow
@@ -579,29 +542,29 @@
 
     private void restoreMySetButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_restoreMySetButtonActionPerformed
-        if (myLayer != null && myDataSet != null && mySelection != null && !mySelection.isEmpty()) {
-            Main.map.mapView.setActiveLayer(myLayer);
-            myLayer.setVisible(true);
-            myDataSet.setSelected(mySelection);
+        if (targetLayer != null && targetDataSet != null && targetSelection != null && !targetSelection.isEmpty()) {
+            Main.map.mapView.setActiveLayer(targetLayer);
+            targetLayer.setVisible(true);
+            targetDataSet.setSelected(targetSelection);
         }
     }//GEN-LAST:event_restoreMySetButtonActionPerformed
 
     private void restoreTheirSetButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_restoreTheirSetButtonActionPerformed
-        if (theirLayer != null && theirDataSet != null && theirSelection != null && !theirSelection.isEmpty()) {
+        if (theirLayer != null && sourceDataSet != null && theirSelection != null && !theirSelection.isEmpty()) {
             Main.map.mapView.setActiveLayer(theirLayer);
             theirLayer.setVisible(true);
-            theirDataSet.setSelected(theirSelection);
+            sourceDataSet.setSelected(theirSelection);
         }
     }//GEN-LAST:event_restoreTheirSetButtonActionPerformed
 
-    private void freezeMySetButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_freezeMySetButtonActionPerformed
-        myDataSet = Main.main.getCurrentDataSet();
-        myLayer = Main.main.getEditLayer();
-        if (myDataSet == null || myLayer == null) {
+    private void freezeTargetSelectionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_freezeTargetSelectionActionPerformed
+        targetDataSet = Main.main.getCurrentDataSet();
+        targetLayer = Main.main.getEditLayer();
+        if (targetDataSet == null || targetLayer == null) {
             JOptionPane.showMessageDialog(Main.parent, tr("No valid OSM data layer present."),
                     tr("Error freezing selection"), JOptionPane.ERROR_MESSAGE);
             return;
         }
-        mySelection = new ArrayList<OsmPrimitive>(myDataSet.getSelected());
-        if (mySelection.isEmpty()) {
+        targetSelection = new ArrayList<OsmPrimitive>(targetDataSet.getSelected());
+        if (targetSelection.isEmpty()) {
             JOptionPane.showMessageDialog(Main.parent, tr("Nothing is selected, please try again."),
                     tr("Empty selection"), JOptionPane.ERROR_MESSAGE);
@@ -612,5 +575,5 @@
         int numWays = 0;
         int numRelations = 0;
-        for (OsmPrimitive p: mySelection) {
+        for (OsmPrimitive p: targetSelection) {
             switch(p.getType()) {
             case NODE: numNodes++; break;
@@ -620,19 +583,19 @@
         }
 
-        myLayerLabel.setText(myLayer.getName());
+        myLayerLabel.setText(targetLayer.getName());
         myNodeCountLabel.setText(Integer.toString(numNodes));
         myWayCountLabel.setText(Integer.toString(numWays));
         myRelationCountLabel.setText(Integer.toString(numRelations));
-    }//GEN-LAST:event_freezeMySetButtonActionPerformed
-
-    private void freezeTheirSelectionButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_freezeTheirSelectionButtonActionPerformed
-        theirDataSet = Main.main.getCurrentDataSet();
+    }//GEN-LAST:event_freezeTargetSelectionActionPerformed
+
+    private void freezeSourceSelectionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_freezeSourceSelectionActionPerformed
+        sourceDataSet = Main.main.getCurrentDataSet();
         theirLayer = Main.main.getEditLayer();
-        if (theirDataSet == null || theirLayer == null) {
+        if (sourceDataSet == null || theirLayer == null) {
             JOptionPane.showMessageDialog(Main.parent, tr("No valid OSM data layer present."),
                     tr("Error freezing selection"), JOptionPane.ERROR_MESSAGE);
             return;
         }
-        theirSelection = new ArrayList<OsmPrimitive>(theirDataSet.getSelected());
+        theirSelection = new ArrayList<OsmPrimitive>(sourceDataSet.getSelected());
         if (theirSelection.isEmpty()) {
             JOptionPane.showMessageDialog(Main.parent, tr("Nothing is selected, please try again."),
@@ -644,5 +607,5 @@
         int numWays = 0;
         int numRelations = 0;
-        for (OsmPrimitive p: mySelection) {
+        for (OsmPrimitive p: theirSelection) {
             switch(p.getType()) {
             case NODE: numNodes++; break;
@@ -656,9 +619,5 @@
         theirWayCountLabel.setText(Integer.toString(numWays));
         theirRelationCountLabel.setText(Integer.toString(numRelations));
-    }//GEN-LAST:event_freezeTheirSelectionButtonActionPerformed
-
-    private void useMyTagsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_useMyTagsButtonActionPerformed
-        int[] rows = resultsTable.getSelectedRows();
-    }//GEN-LAST:event_useMyTagsButtonActionPerformed
+    }//GEN-LAST:event_freezeSourceSelectionActionPerformed
 
     private void jCheckBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBox1ActionPerformed
@@ -667,12 +626,11 @@
 
     private void resolveButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_resolveButtonActionPerformed
-        if (!conflictResolver.isResolvedCompletely()) {
-            JOptionPane.showMessageDialog(Main.parent, tr("Unresolved differences remain, please fix remaining differences."),
-                    tr("Conflict not resolved completely"), JOptionPane.ERROR_MESSAGE);
-                    return;
-        }
-        Command cmd = conflictResolver.buildResolveCommand();
-        Main.main.undoRedo.add(cmd);
+        // FIXME: perform replace geometry
+        //Main.main.undoRedo.add(cmd);
     }//GEN-LAST:event_resolveButtonActionPerformed
+
+    private void replaceGeometryButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_replaceGeometryButtonActionPerformed
+        
+    }//GEN-LAST:event_replaceGeometryButtonActionPerformed
 
     static public class LayerListCellRenderer extends DefaultListCellRenderer {
@@ -725,5 +683,5 @@
 
         public int getRowCount() {
-            return conflicts.size();
+            return candidates.size();
         }
 
@@ -735,11 +693,11 @@
         public Object getValueAt(int row, int col) {
             if (col == 0)
-                return conflicts.get(row).getMy();
+                return candidates.get(row).getSource();
             if (col == 1)
-                return conflicts.get(row).getTheir();
+                return candidates.get(row).getTarget();
             if (col == 4) {
                 HashSet<OsmPrimitive> set = new HashSet<OsmPrimitive>();
-                set.add(conflicts.get(row).getMy());
-                set.add(conflicts.get(row).getTheir());
+                set.add(candidates.get(row).getSource());
+                set.add(candidates.get(row).getTarget());
                 TagCollection tags = TagCollection.unionOfAllPrimitives(set);
                 Set<String> keys = tags.getKeysWithMultipleValues();
@@ -804,10 +762,13 @@
             // only one item selected, show tags and zoom/center map
             if (!lsm.isSelectionEmpty() && firstIndex == lastIndex) {
-                Conflict<?> c = conflicts.get(firstIndex);
-                conflictResolver.populate(c);
+                ConflationCandidate c = candidates.get(firstIndex);
+                
+                conflationLayer.setSelectedCandidate(c);
+                
+                targetDataSet.setSelected(Arrays.asList(c.getTarget(), c.getSource()));
                 
                 ArrayList<OsmPrimitive> sel = new ArrayList<OsmPrimitive>();
-                sel.add(c.getMy());
-                sel.add(c.getTheir());
+                sel.add(c.getSource());
+                sel.add(c.getTarget());
 
                 BoundingXYVisitor box = new BoundingXYVisitor();
@@ -835,4 +796,25 @@
         System.err.println("1 conflict has been resolved.");
         refreshView();
+    }
+    
+    public class ConflationCandidate {
+        protected OsmPrimitive source;
+        protected OsmPrimitive target;
+        
+        public ConflationCandidate(OsmPrimitive source, OsmPrimitive target) {
+            if (source == null || target == null) {
+                throw new IllegalArgumentException("Invalid source or target");
+            }
+            this.source = source;
+            this.target = target;
+        }
+        
+        public OsmPrimitive getSource() {
+            return source;
+        }
+        
+        public OsmPrimitive getTarget() {
+            return target;
+        }
     }
 
@@ -865,4 +847,5 @@
     private javax.swing.JPanel objectTabPanel;
     private javax.swing.JPanel refSetPanel;
+    private javax.swing.JButton replaceGeometryButton;
     private javax.swing.JButton resolveButton;
     private javax.swing.JButton restoreMySetButton;
@@ -871,10 +854,8 @@
     private javax.swing.JTabbedPane resultsTabPanel;
     private javax.swing.JTable resultsTable;
-    private javax.swing.JPanel tagMergerPlaceholderPanel;
     private javax.swing.JLabel theirLayerLabel;
     private javax.swing.JLabel theirNodeCountLabel;
     private javax.swing.JLabel theirRelationCountLabel;
     private javax.swing.JLabel theirWayCountLabel;
-    private javax.swing.JButton useMyTagsButton;
     private javax.swing.JButton useTheirTagsButton;
     // End of variables declaration//GEN-END:variables
