Index: trunk/autoquest-plugin-android/src/main/java/de/ugoe/cs/autoquest/plugin/android/guimodel/ANDROIDGUIElementSpec.java
===================================================================
--- trunk/autoquest-plugin-android/src/main/java/de/ugoe/cs/autoquest/plugin/android/guimodel/ANDROIDGUIElementSpec.java	(revision 1869)
+++ trunk/autoquest-plugin-android/src/main/java/de/ugoe/cs/autoquest/plugin/android/guimodel/ANDROIDGUIElementSpec.java	(revision 1880)
@@ -53,5 +53,5 @@
      * <p>
      * Path to an element in an activity. e.g. a path of a button could look like
-     * MainActivity/DecorView/ActionBarOverlayLayout/FrameLayout/ RelativeLayout/Button
+     * MainActivity/DecorView/ActionBarOverlayLayout/FrameLayout/RelativeLayout/Button
      * </p>
      */
@@ -86,9 +86,16 @@
     /**
      * <p>
+     * The position of the element in the original GUI.
+     * </p>
+     */
+    private int elementPosition;
+
+    /**
+     * <p>
      * Type hierarchy of the class itself.
      * </p>
      */
     private List<String> typeHierarchy = null;
-    
+
     /*
      * (non-Javadoc)
@@ -121,5 +128,26 @@
          */
 
-        if (otherSpec.index > 1 && index == otherSpec.index) {
+        if (otherSpec.getIndex() > 1 && getIndex() == otherSpec.getIndex()) {
+            return true;
+        }
+
+        /*
+         * Path and label of the elements fits together. In this case it is most likely that this
+         * elements fits together. This only makes since in the case a label exists.
+         */
+        if (otherSpec.getName() != "NOT_SET" && getName() != "NOT_SET" &&
+            !otherSpec.getName().contains("image:") && getName().contains("image:") &&
+            otherSpec.getName() == getName() && otherSpec.getPath() == getPath())
+        {
+            return true;
+        }
+
+        /*
+         * Path and position fits together. In this case it is most likely that this elements fits
+         * together.
+         */
+        if (otherSpec.getPath() == getPath() &&
+            otherSpec.getElementPosition() == getElementPosition())
+        {
             return true;
         }
@@ -142,5 +170,4 @@
         return false;
     }
-    
 
     /*
@@ -168,5 +195,5 @@
             return typeHierarchy.toArray(new String[typeHierarchy.size()]);
     }
-    
+
     /**
      * <p>
@@ -210,5 +237,5 @@
      * @return text or image of the GUI element.
      */
-    public String getName() {        
+    public String getName() {
         if (name == null || name.trim().length() == 0) {
             return "NOT_SET";
@@ -218,4 +245,28 @@
 
     /**
+     * 
+     * <p>
+     * Return the position of the element in the original GUI.
+     * </p>
+     * 
+     * @return position of the element in the original GUI.
+     */
+    public int getElementPosition() {
+        return elementPosition;
+    }
+
+    /**
+     * 
+     * <p>
+     * Set the position of the element in the original GUI.
+     * </p>
+     * 
+     * @param elementPosition
+     */
+    public void setElementPosition(int elementPosition) {
+        this.elementPosition = elementPosition;
+    }
+
+    /**
      * <p>
      * Sets the GUI element identifier.
@@ -282,5 +333,5 @@
         this.typeHierarchy = typeHierarchy;
     }
-    
+
     /*
      * (non-Javadoc)
@@ -303,8 +354,9 @@
             (path == null ? otherSpec.path == null : path.equals(otherSpec.path)) &&
             (index == otherSpec.index) &&
+            (elementPosition == otherSpec.elementPosition) &&
             (name == null ? otherSpec.name == null : name.equals(otherSpec.name)) &&
             (type == null ? otherSpec.type == null : type.equals(otherSpec.type));
     }
-    
+
     /*
      * (non-Javadoc)
@@ -314,5 +366,5 @@
     @Override
     public int hashCode() {
-     // 17 due to the reason that this is a prime number.
+        // 17 due to the reason that this is a prime number.
         int result = 17;
         /*
@@ -324,8 +376,8 @@
         result = 31 * result + index;
         result = 31 * result + getName().hashCode();
-        result = 31 * result + type.hashCode();     
+        result = 31 * result + type.hashCode();
+        result = 31 * result + elementPosition;
         return result;
     }
-    
 
 }
