Index: /applications/editors/josm/plugins/ElevationProfile/build.xml
===================================================================
--- /applications/editors/josm/plugins/ElevationProfile/build.xml	(revision 29954)
+++ /applications/editors/josm/plugins/ElevationProfile/build.xml	(revision 29955)
@@ -2,5 +2,5 @@
 <project name="ElevationProfile" default="dist" basedir=".">
     <!-- enter the SVN commit message -->
-    <property name="commit.message" value=""/>
+    <property name="commit.message" value="[josm_elevationprofile]"/>
     <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
     <property name="plugin.main.version" value="6162"/>
Index: /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/ElevationMapMode.java
===================================================================
--- /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/ElevationMapMode.java	(revision 29954)
+++ /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/ElevationMapMode.java	(revision 29955)
@@ -21,5 +21,4 @@
 import org.openstreetmap.josm.actions.mapmode.MapMode;
 import org.openstreetmap.josm.gui.MapFrame;
-import org.openstreetmap.josm.plugins.elevation.gpx.IElevationProfile;
 
 /**
Index: /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/HgtReader.java
===================================================================
--- /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/HgtReader.java	(revision 29954)
+++ /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/HgtReader.java	(revision 29955)
@@ -44,11 +44,8 @@
 	        for (String location : Main.pref.getAllPossiblePreferenceDirs()) {	            
 	    		String fullPath = new File(location + File.separator + "elevation", file).getPath();
-	    			  
-	    		System.out.println(fullPath);
     	    		File f = new File(fullPath);
     	    		if (f.exists()) {
     	    		    // found something: read HGT file...
-    	    		    ShortBuffer data = readHgtFile(fullPath);
-    	    		    System.out.println("Read SRTM data from " + fullPath + ", tag is '" + file + "'");
+    	    		    ShortBuffer data = readHgtFile(fullPath);    	    		    
     	    		    // ... and store result in cache
     	    		    cache.put(file, data);
@@ -109,5 +106,4 @@
 	
 	if (sb == null) {
-	    System.out.println("readElevation: Buffer is null for tag '" + tag + "'");
 	    return ElevationHelper.NO_ELEVATION;
 	}
Index: /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/IElevationModel.java
===================================================================
--- /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/IElevationModel.java	(revision 29955)
+++ /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/IElevationModel.java	(revision 29955)
@@ -0,0 +1,64 @@
+package org.openstreetmap.josm.plugins.elevation;
+
+import java.util.List;
+
+
+public interface IElevationModel {
+
+    /**
+     * Adds a model listener to this instance.
+     * 
+     * @param listener
+     *            The listener to add.
+     */
+    public abstract void addModelListener(IElevationModelListener listener);
+
+    /**
+     * Removes a model listener from this instance.
+     * 
+     * @param listener
+     *            The listener to remove.
+     */
+    public abstract void removeModelListener(IElevationModelListener listener);
+
+    /**
+     * Removes all listeners from this instance.
+     */
+    public abstract void removeAllListeners();
+
+    /**
+     * Gets the elevation profiles. In most GPX files there may by
+     *
+     * @return the profiles
+     */
+    public abstract List<IElevationProfile> getProfiles();
+    
+    /**
+     * Gets the current profile.
+     *
+     * @return the current profile
+     */
+    public abstract IElevationProfile getCurrentProfile();
+    
+    /**
+     * Sets the current profile.
+     *
+     * @param newProfile the new current profile
+     */
+    public abstract void setCurrentProfile(IElevationProfile newProfile);
+    
+    /**
+     * Sets the current profile by index.
+     *
+     * @param index the new current profile. Valied numbers are 0 to (profileCount - 1)
+     */
+    public abstract void setCurrentProfile(int index);
+    
+    /**
+     * Gets the number of elevation profiles within the model.
+     *
+     * @return the int
+     */
+    public abstract int profileCount();
+
+}
Index: /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/IElevationModelListener.java
===================================================================
--- /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/IElevationModelListener.java	(revision 29954)
+++ /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/IElevationModelListener.java	(revision 29955)
@@ -16,5 +16,4 @@
 
 import org.openstreetmap.josm.plugins.elevation.gpx.ElevationModel;
-import org.openstreetmap.josm.plugins.elevation.gpx.IElevationProfile;
 
 /**
Index: /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/IElevationProfile.java
===================================================================
--- /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/IElevationProfile.java	(revision 29955)
+++ /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/IElevationProfile.java	(revision 29955)
@@ -0,0 +1,150 @@
+/**
+ * This program is free software: you can redistribute it and/or modify it under 
+ * the terms of the GNU General Public License as published by the 
+ * Free Software Foundation, either version 3 of the License, or 
+ * (at your option) any later version. 
+ * 
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
+ * See the GNU General Public License for more details. 
+ * 
+ * You should have received a copy of the GNU General Public License along with this program. 
+ * If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package org.openstreetmap.josm.plugins.elevation;
+
+import java.util.Date;
+import java.util.List;
+
+import org.openstreetmap.josm.data.gpx.WayPoint;
+
+/**
+ * @author Oliver Wieland <oliver.wieland@online.de>
+ * Interface for an elevation profile providing special properties/values.
+ */
+public interface IElevationProfile {
+	/**
+	 * Gets the name of the elevation profile.
+	 * @return
+	 */
+	public abstract String getName();
+	
+	/**
+	 * Gets the time stamp of first recorded track point.
+	 * @return
+	 */
+	public abstract Date getStart();
+
+	/**
+	 * Gets the time stamp of last recorded track point.
+	 * @return
+	 */
+	public abstract Date getEnd();
+	
+	/**
+	 * Gets the minimum elevation height of all tracks and routes.
+	 * @return
+	 */
+	public abstract int getMinHeight();
+
+	/**
+	 * Gets the maximum elevation height of all tracks and routes.
+	 * @return
+	 */
+	public abstract int getMaxHeight();
+	
+	/**
+	 * Gets the distance of the track in kilometers.
+	 */
+	public abstract double getDistance();
+	
+	/**
+	 * Gets the average elevation height of all tracks and routes.
+	 * @return
+	 */
+	public abstract int getAverageHeight();
+	
+	/**
+	 * Gets the difference between min and max elevation.
+	 * @return
+	 */
+	public int getHeightDifference();
+	
+	/**
+	 * Gets the elevation gain.
+	 * 
+	 * @return
+	 */
+	public int getGain();
+
+	/**
+	 * Gets the total number of way points (sum of all way points of all tracks and routes). 
+	 * @return
+	 */
+	public abstract int getNumberOfWayPoints();
+	
+	/**
+	 * Gets the list containing the way points.
+	 * @return
+	 */
+	public List<WayPoint> getWayPoints();
+	
+	/**
+	 * Gets the first recorded way point.
+	 * @return
+	 */
+	public WayPoint getStartWayPoint();
+	
+	/**
+	 * Gets the last recorded way point.
+	 * @return
+	 */
+	public WayPoint getEndWayPoint();
+	
+	/**
+	 * Gets the way point with the highest elevation value.
+	 * @return
+	 */
+	public WayPoint getMaxWayPoint();
+	
+	/**
+	 * Gets the way point with the lowest elevation value.
+	 * @return
+	 */
+	public WayPoint getMinWayPoint();
+	
+	/**
+	 * Gets a flag indicating whether the associated way points 
+	 * contained elevation data or not. This is the case if min
+	 * and max height are equal.
+	 * @return
+	 */
+	public boolean hasElevationData();
+
+	/**
+	 * Returns the time between start and end of the track.
+	 * @return
+	 */
+	public long getTimeDifference();
+	
+	/**
+	 * Gets the elevation value for at the given data index point.
+	 */
+	public int elevationValueAt(int i);
+	
+	/**
+	 * Gets the children of the segment (maybe null).
+	 */
+	public List<IElevationProfile> getChildren();
+	
+	/**
+	 * Gets the parent of the elevation profile.
+	 */
+	public IElevationProfile getParent();
+	
+	/**
+	 * Triggers model refresh.
+	 */
+	public void updateElevationData();
+}
Index: /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gpx/ElevationModel.java
===================================================================
--- /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gpx/ElevationModel.java	(revision 29954)
+++ /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gpx/ElevationModel.java	(revision 29955)
@@ -23,5 +23,7 @@
 import org.openstreetmap.josm.data.gpx.GpxTrackSegment;
 import org.openstreetmap.josm.data.gpx.WayPoint;
+import org.openstreetmap.josm.plugins.elevation.IElevationModel;
 import org.openstreetmap.josm.plugins.elevation.IElevationModelListener;
+import org.openstreetmap.josm.plugins.elevation.IElevationProfile;
 import org.openstreetmap.josm.tools.CheckParameterUtil;
 
@@ -37,10 +39,10 @@
 	private int trackCounter;
 	private GpxData gpxData;
-
+	private String name;
 	private WayPointMap children = new WayPointMap(); 
 	private List<IElevationModelListener> listeners = new ArrayList<IElevationModelListener>();
 	private List<WayPoint> buffer = new ArrayList<WayPoint>();
 	private int currentProfileIndex = 0;
-	
+	private ElevationProfileBase curProfile = null;
 
 	/**
@@ -59,5 +61,5 @@
 	public ElevationModel(String name, GpxData data) {
 		gpxData = data;
-		
+		this.name = name;
 		GpxIterator.visit(data, this);		
 	}
@@ -135,4 +137,5 @@
 	    	// we ignore the segment here 
 		processWayPoint(wp);
+		
 	}
 	
@@ -146,22 +149,52 @@
 
 	public void start() {
-		children.clear();		
+		curProfile = new ElevationProfileBase(name);		
 	}
 
 	public void end() {
-		String trackName = "Track#" + trackCounter;
-		addTrackOrRoute(trackName);		
-	}
-	
+		String trackName = name; //gpxData.getString(GpxData.META_NAME);// "Track#" + trackCounter;
+		
+		if (trackCounter > 0) {
+		    trackName += "." + trackCounter;
+		}
+		addTrackOrRoute(trackName);	
+		trackCounter++;
+	}
+	
+
+	@Override
+	public void start(GpxTrack track) {
+	    curProfile = new ElevationProfileBase(name);	    
+	}
+
+	@Override
+	public void end(GpxTrack track) {
+	    if (curProfile == null) throw new RuntimeException("Internal error: No elevation profile");
+	    
+	    curProfile.setDistance(track.length());
+	    addTrackOrRoute(name);	    
+	}
+	
+	@Override
+	public void start(GpxTrack track, GpxTrackSegment segment) {
+	    // Nothing to do here for now
+	}
+
+	@Override
+	public void end(GpxTrack track, GpxTrackSegment segment) {
+	    // Nothing to do here for now
+	}
+
+	
+	/**
+	 * Adds a track or route to the internal track list.
+	 *
+	 * @param trackName the track name
+	 */
 	private void addTrackOrRoute(String trackName) {
-	    	if (buffer.size() > 0) {
-	    	    
-	    	    	System.out.println("Add track " + trackName + ", n =  " + buffer.size()); // TODO: Remove
-	    	    	
-        	    	ElevationProfileBase ep = new ElevationProfileBase(trackName);
-        		ep.setWayPoints(buffer);
-        		ep.setName(trackName);
-        		children.add(ep);
-        		buffer.clear();
+	    	if (buffer.size() > 0) {        	    	
+        		curProfile.setWayPoints(buffer);
+        		curProfile.setName(trackName);
+        		children.add(curProfile);
 	    	}
 	}
Index: /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gpx/ElevationProfileBase.java
===================================================================
--- /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gpx/ElevationProfileBase.java	(revision 29954)
+++ /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gpx/ElevationProfileBase.java	(revision 29955)
@@ -21,4 +21,5 @@
 import org.openstreetmap.josm.data.gpx.WayPoint;
 import org.openstreetmap.josm.plugins.elevation.ElevationHelper;
+import org.openstreetmap.josm.plugins.elevation.IElevationProfile;
 
 /**
Index: /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gpx/GpxIterator.java
===================================================================
--- /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gpx/GpxIterator.java	(revision 29954)
+++ /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gpx/GpxIterator.java	(revision 29955)
@@ -45,4 +45,6 @@
 		if (data == null) return;
 		if (visitor == null) return;
+		
+		if (data.isEmpty()) return;
 		
 		visitor.start();
@@ -94,19 +96,25 @@
 		
 		Collection<GpxTrackSegment> segments = trk.getSegments();
-		visitor.start();
-
+		
 		if (segments != null) {
+		    	visitor.start(trk);
+		    	// visit all segments
 			for (GpxTrackSegment segment : segments) {
-				Collection<WayPoint> waypts = segment.getWayPoints();
-				// no visitor here...
+			    Collection<WayPoint> waypts = segment.getWayPoints();
+			    	// no visitor here...
 				if (waypts == null)
 					continue;
-
+				
+			        visitor.start(trk, segment);
+			        
 				for (WayPoint wayPoint : waypts) {
 					visitor.visit(wayPoint);
 				}
+				
+				visitor.end(trk, segment);
 			}
-		}
-		visitor.end();
+			visitor.end(trk);
+		}		
+		
 	}
 
Index: plications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gpx/IElevationModel.java
===================================================================
--- /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gpx/IElevationModel.java	(revision 29954)
+++ 	(revision )
@@ -1,65 +1,0 @@
-package org.openstreetmap.josm.plugins.elevation.gpx;
-
-import java.util.List;
-
-import org.openstreetmap.josm.plugins.elevation.IElevationModelListener;
-
-public interface IElevationModel {
-
-    /**
-     * Adds a model listener to this instance.
-     * 
-     * @param listener
-     *            The listener to add.
-     */
-    public abstract void addModelListener(IElevationModelListener listener);
-
-    /**
-     * Removes a model listener from this instance.
-     * 
-     * @param listener
-     *            The listener to remove.
-     */
-    public abstract void removeModelListener(IElevationModelListener listener);
-
-    /**
-     * Removes all listeners from this instance.
-     */
-    public abstract void removeAllListeners();
-
-    /**
-     * Gets the elevation profiles. In most GPX files there may by
-     *
-     * @return the profiles
-     */
-    public abstract List<IElevationProfile> getProfiles();
-    
-    /**
-     * Gets the current profile.
-     *
-     * @return the current profile
-     */
-    public abstract IElevationProfile getCurrentProfile();
-    
-    /**
-     * Sets the current profile.
-     *
-     * @param newProfile the new current profile
-     */
-    public abstract void setCurrentProfile(IElevationProfile newProfile);
-    
-    /**
-     * Sets the current profile by index.
-     *
-     * @param index the new current profile. Valied numbers are 0 to (profileCount - 1)
-     */
-    public abstract void setCurrentProfile(int index);
-    
-    /**
-     * Gets the number of elevation profiles within the model.
-     *
-     * @return the int
-     */
-    public abstract int profileCount();
-
-}
Index: plications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gpx/IElevationProfile.java
===================================================================
--- /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gpx/IElevationProfile.java	(revision 29954)
+++ 	(revision )
@@ -1,150 +1,0 @@
-/**
- * This program is free software: you can redistribute it and/or modify it under 
- * the terms of the GNU General Public License as published by the 
- * Free Software Foundation, either version 3 of the License, or 
- * (at your option) any later version. 
- * 
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
- * See the GNU General Public License for more details. 
- * 
- * You should have received a copy of the GNU General Public License along with this program. 
- * If not, see <http://www.gnu.org/licenses/>.
- */
-
-package org.openstreetmap.josm.plugins.elevation.gpx;
-
-import java.util.Date;
-import java.util.List;
-
-import org.openstreetmap.josm.data.gpx.WayPoint;
-
-/**
- * @author Oliver Wieland <oliver.wieland@online.de>
- * Interface for an elevation profile providing special properties/values.
- */
-public interface IElevationProfile {
-	/**
-	 * Gets the name of the elevation profile.
-	 * @return
-	 */
-	public abstract String getName();
-	
-	/**
-	 * Gets the time stamp of first recorded track point.
-	 * @return
-	 */
-	public abstract Date getStart();
-
-	/**
-	 * Gets the time stamp of last recorded track point.
-	 * @return
-	 */
-	public abstract Date getEnd();
-	
-	/**
-	 * Gets the minimum elevation height of all tracks and routes.
-	 * @return
-	 */
-	public abstract int getMinHeight();
-
-	/**
-	 * Gets the maximum elevation height of all tracks and routes.
-	 * @return
-	 */
-	public abstract int getMaxHeight();
-	
-	/**
-	 * Gets the distance of the track in kilometers.
-	 */
-	public abstract double getDistance();
-	
-	/**
-	 * Gets the average elevation height of all tracks and routes.
-	 * @return
-	 */
-	public abstract int getAverageHeight();
-	
-	/**
-	 * Gets the difference between min and max elevation.
-	 * @return
-	 */
-	public int getHeightDifference();
-	
-	/**
-	 * Gets the elevation gain.
-	 * 
-	 * @return
-	 */
-	public int getGain();
-
-	/**
-	 * Gets the total number of way points (sum of all way points of all tracks and routes). 
-	 * @return
-	 */
-	public abstract int getNumberOfWayPoints();
-	
-	/**
-	 * Gets the list containing the way points.
-	 * @return
-	 */
-	public List<WayPoint> getWayPoints();
-	
-	/**
-	 * Gets the first recorded way point.
-	 * @return
-	 */
-	public WayPoint getStartWayPoint();
-	
-	/**
-	 * Gets the last recorded way point.
-	 * @return
-	 */
-	public WayPoint getEndWayPoint();
-	
-	/**
-	 * Gets the way point with the highest elevation value.
-	 * @return
-	 */
-	public WayPoint getMaxWayPoint();
-	
-	/**
-	 * Gets the way point with the lowest elevation value.
-	 * @return
-	 */
-	public WayPoint getMinWayPoint();
-	
-	/**
-	 * Gets a flag indicating whether the associated way points 
-	 * contained elevation data or not. This is the case if min
-	 * and max height are equal.
-	 * @return
-	 */
-	public boolean hasElevationData();
-
-	/**
-	 * Returns the time between start and end of the track.
-	 * @return
-	 */
-	public long getTimeDifference();
-	
-	/**
-	 * Gets the elevation value for at the given data index point.
-	 */
-	public int elevationValueAt(int i);
-	
-	/**
-	 * Gets the children of the segment (maybe null).
-	 */
-	public List<IElevationProfile> getChildren();
-	
-	/**
-	 * Gets the parent of the elevation profile.
-	 */
-	public IElevationProfile getParent();
-	
-	/**
-	 * Triggers model refresh.
-	 */
-	public void updateElevationData();
-}
Index: /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gpx/IGpxVisitor.java
===================================================================
--- /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gpx/IGpxVisitor.java	(revision 29954)
+++ /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gpx/IGpxVisitor.java	(revision 29955)
@@ -15,4 +15,6 @@
 package org.openstreetmap.josm.plugins.elevation.gpx;
 
+import org.openstreetmap.josm.data.gpx.GpxTrack;
+import org.openstreetmap.josm.data.gpx.GpxTrackSegment;
 import org.openstreetmap.josm.data.gpx.WayPoint;
 
@@ -23,12 +25,33 @@
 public interface IGpxVisitor extends IGpxWaypointVisitor {
 	/**
-	 * Starts a GPX route, track or way point collection.
+	 * Starts a GPX route or way point collection.
 	 */
 	void start();
 	
 	/**
-	 * Ends a GPX route, track or way point collection.
+	 * Ends a GPX route or way point collection.
 	 */
 	void end();
+	
+	/**
+	 * Starts a GPX track.
+	 */
+	void start(GpxTrack track);
+	
+	/**
+	 * Ends a GPX track.
+	 */
+	void end(GpxTrack track);
+
+	
+	/**
+	 * Starts a segment within a GPX track.
+	 */
+	void start(GpxTrack track, GpxTrackSegment segment);
+	
+	/**
+	 * Ends a segment within a GPX track.
+	 */
+	void end(GpxTrack track, GpxTrackSegment segment);
 	
 	/**
Index: /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gpx/WayPointMap.java
===================================================================
--- /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gpx/WayPointMap.java	(revision 29954)
+++ /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gpx/WayPointMap.java	(revision 29955)
@@ -2,4 +2,6 @@
 
 import java.util.ArrayList;
+
+import org.openstreetmap.josm.plugins.elevation.IElevationProfile;
 
 public class WayPointMap extends ArrayList<IElevationProfile> {
Index: /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gui/DefaultElevationProfileRenderer.java
===================================================================
--- /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gui/DefaultElevationProfileRenderer.java	(revision 29954)
+++ /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gui/DefaultElevationProfileRenderer.java	(revision 29955)
@@ -35,6 +35,6 @@
 import org.openstreetmap.josm.gui.MapView;
 import org.openstreetmap.josm.plugins.elevation.ElevationHelper;
+import org.openstreetmap.josm.plugins.elevation.IElevationProfile;
 import org.openstreetmap.josm.plugins.elevation.gpx.ElevationWayPointKind;
-import org.openstreetmap.josm.plugins.elevation.gpx.IElevationProfile;
 import org.openstreetmap.josm.tools.CheckParameterUtil;
 
@@ -62,4 +62,6 @@
 	private static final Color START_COLOR = Color.GREEN;
 	private static final Color END_POINT = Color.RED;
+	private static final Color LEVEL_GAIN_COLOR = Color.GREEN;
+	private static final Color LEVEL_LOSS_COLOR = Color.RED;
 	private static final Color MARKER_POINT = Color.YELLOW;
 	// Predefined radians
@@ -93,12 +95,9 @@
 		switch (kind) {
 		case Plain:
-		    return Color.LIGHT_GRAY;
+		    	return Color.LIGHT_GRAY;
 		case ElevationLevelLoss:
+		    	return LEVEL_LOSS_COLOR;
 		case ElevationLevelGain:
-			if (z > profile.getAverageHeight()) {
-				return HIGH_COLOR;
-			} else {
-				return LOW_COLOR;
-			}
+			return LEVEL_GAIN_COLOR;
 		case Highlighted:
 			return Color.ORANGE;
@@ -108,7 +107,7 @@
 			return Color.getHSBColor(0, 1.0f, 1.0f); // red
 		case ElevationGainLow:
-		    	return Color.getHSBColor(0.3f, 0.7f, 1.0f); // green with low sat
+		    	return Color.getHSBColor(0.3f, 0.5f, 1.0f); // green with low sat
 		case ElevationLossLow:
-			return Color.getHSBColor(0, 0.7f, 1.0f); // red with low sat
+			return Color.getHSBColor(0, 0.5f, 1.0f); // red with low sat
 		case FullHour:
 			return MARKER_POINT;
@@ -238,7 +237,7 @@
 		    	int ele = ((int) Math.rint(ElevationHelper.getElevation(wpt) / 100.0)) * 100;
 			drawLabelWithTriangle(ElevationHelper.getElevationText(ele), pnt.x, pnt.y
-					+ g.getFontMetrics().getHeight(), g, c, 8, 
+					+ g.getFontMetrics().getHeight(), g, Color.darkGray, 8, 
 					getColorForWaypoint(profile, wpt, kind),
-					TriangleDir.Up);
+					kind == ElevationWayPointKind.ElevationLevelGain ? TriangleDir.Up : TriangleDir.Down);
 		}
 
Index: /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gui/ElevationProfileDialog.java
===================================================================
--- /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gui/ElevationProfileDialog.java	(revision 29954)
+++ /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gui/ElevationProfileDialog.java	(revision 29955)
@@ -40,9 +40,9 @@
 import org.openstreetmap.josm.gui.layer.Layer;
 import org.openstreetmap.josm.plugins.elevation.ElevationHelper;
+import org.openstreetmap.josm.plugins.elevation.IElevationModel;
 import org.openstreetmap.josm.plugins.elevation.IElevationModelListener;
+import org.openstreetmap.josm.plugins.elevation.IElevationProfile;
 import org.openstreetmap.josm.plugins.elevation.gpx.ElevationModel;
 import org.openstreetmap.josm.plugins.elevation.gpx.GeoidCorrectionKind;
-import org.openstreetmap.josm.plugins.elevation.gpx.IElevationModel;
-import org.openstreetmap.josm.plugins.elevation.gpx.IElevationProfile;
 import org.openstreetmap.josm.tools.Shortcut;
 /**
Index: /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gui/ElevationProfileLayer.java
===================================================================
--- /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gui/ElevationProfileLayer.java	(revision 29954)
+++ /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gui/ElevationProfileLayer.java	(revision 29955)
@@ -31,6 +31,6 @@
 import org.openstreetmap.josm.gui.layer.Layer;
 import org.openstreetmap.josm.plugins.elevation.ElevationHelper;
+import org.openstreetmap.josm.plugins.elevation.IElevationProfile;
 import org.openstreetmap.josm.plugins.elevation.gpx.ElevationWayPointKind;
-import org.openstreetmap.josm.plugins.elevation.gpx.IElevationProfile;
 import org.openstreetmap.josm.tools.ImageProvider;
 
@@ -88,5 +88,5 @@
     @Override
     public Icon getIcon() {
-	return ImageProvider.get("layer", "elevation_small");
+	return ImageProvider.get("layer", "elevation");
     }
 
@@ -245,8 +245,8 @@
 		// TODO: Provide parameters for high/low thresholds
 		if (slope > 2) kind =ElevationWayPointKind.ElevationGainLow;
-		if (slope > 10) kind =ElevationWayPointKind.ElevationGainHigh;
+		if (slope > 15) kind =ElevationWayPointKind.ElevationGainHigh;
 	    } else {
 		if (slope > 2) kind =ElevationWayPointKind.ElevationLossLow;
-		if (slope > 10) kind =ElevationWayPointKind.ElevationLossHigh;
+		if (slope > 15) kind =ElevationWayPointKind.ElevationLossHigh;
 	    }
 	}
Index: /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gui/ElevationProfilePanel.java
===================================================================
--- /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gui/ElevationProfilePanel.java	(revision 29954)
+++ /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gui/ElevationProfilePanel.java	(revision 29955)
@@ -38,7 +38,7 @@
 import org.openstreetmap.josm.data.gpx.WayPoint;
 import org.openstreetmap.josm.plugins.elevation.ElevationHelper;
+import org.openstreetmap.josm.plugins.elevation.IElevationModel;
+import org.openstreetmap.josm.plugins.elevation.IElevationProfile;
 import org.openstreetmap.josm.plugins.elevation.gpx.ElevationWayPointKind;
-import org.openstreetmap.josm.plugins.elevation.gpx.IElevationModel;
-import org.openstreetmap.josm.plugins.elevation.gpx.IElevationProfile;
 
 /**
@@ -142,5 +142,5 @@
 	    
 	    	int selWp = this.selectedIndex * step;
-		if (profile != null && profile.getWayPoints() != null && profile.getWayPoints().size() > selWp) {
+		if (profile != null && profile.getWayPoints() != null && selWp > 0 && profile.getWayPoints().size() > selWp) {
 			return profile.getWayPoints().get(selWp);
 		} else {
Index: /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gui/IElevationProfileRenderer.java
===================================================================
--- /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gui/IElevationProfileRenderer.java	(revision 29954)
+++ /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gui/IElevationProfileRenderer.java	(revision 29955)
@@ -20,6 +20,6 @@
 import org.openstreetmap.josm.data.gpx.WayPoint;
 import org.openstreetmap.josm.gui.MapView;
+import org.openstreetmap.josm.plugins.elevation.IElevationProfile;
 import org.openstreetmap.josm.plugins.elevation.gpx.ElevationWayPointKind;
-import org.openstreetmap.josm.plugins.elevation.gpx.IElevationProfile;
 
 /**
