Index: src/uk/me/parabola/imgfmt/app/mdr/MDRFile.java
===================================================================
--- src/uk/me/parabola/imgfmt/app/mdr/MDRFile.java	(revision 4872)
+++ src/uk/me/parabola/imgfmt/app/mdr/MDRFile.java	(working copy)
@@ -76,7 +76,6 @@
 
 	private final MdrSection[] sections;
 	private PointerSizes sizes;
-	private Set<String> mdr7Del;
 
 	private Set<Integer> poiExclTypes; 
 
@@ -85,7 +84,6 @@
 
 		forDevice = config.isForDevice();
 		isMulti = config.getSort().isMulti();
-		mdr7Del = config.getMdr7Del();
 		poiExclTypes = config.getPoiExclTypes();
 		mdrHeader = new MDRHeader(config.getHeaderLen());
 		mdrHeader.setSort(sort);
@@ -243,33 +241,10 @@
 				continue;
 			
 			String name = lab.getText();
-			if (!mdr7Del.isEmpty()) {
-				String[] parts = name.split(" ");
-				int pos = parts.length;
-				for (int i = parts.length - 1; i >= 0; i--) {
-					if (!mdr7Del.contains(parts[i])) {
-						break;
-					}
-					pos = i;
-				}
-				if (pos == 0)
-					continue;
-				if (pos < parts.length) {
-					StringBuilder sb = new StringBuilder();
-					for (int i = 0; i + 1 < pos; i++) {
-						sb.append(parts[i]);
-						sb.append(" ");
-					}
-					sb.append(parts[pos - 1]);
-					name = sb.toString(); // XXX maybe add -intern()
-				}
-			}
-			
-			int strOff = createString(name);
 
 			// We sort on the dirty name (ie with the Garmin shield codes) although those codes do not
 			// affect the sort order. The string for mdr15 does not include the shield codes.
-			mdr7.addStreet(currentMap, name, lab.getOffset(), strOff, mdrCity);
+			mdr7.addStreet(currentMap, name, lab.getOffset(), this::createString, mdrCity);
 		}
 	}
 
Index: src/uk/me/parabola/imgfmt/app/mdr/Mdr7.java
===================================================================
--- src/uk/me/parabola/imgfmt/app/mdr/Mdr7.java	(revision 4872)
+++ src/uk/me/parabola/imgfmt/app/mdr/Mdr7.java	(working copy)
@@ -19,6 +19,7 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.function.ToIntFunction;
 
 import uk.me.parabola.imgfmt.MapFailedException;
 import uk.me.parabola.imgfmt.app.ImgFileWriter;
@@ -57,6 +58,7 @@
 	private int maxSuffixCount;
 	private boolean magicIsValid;
 	private int magic;
+	private Set<String> mdr7Del;
 
 	public Mdr7(MdrConfig config) {
 		setConfig(config);
@@ -64,14 +66,20 @@
 		collator = sort.getCollator();
 		splitName = config.isSplitName();
 		exclNames = config.getMdr7Excl();
+		mdr7Del = config.getMdr7Del();
 		codepage = sort.getCodepage();
 		isMulti = sort.isMulti();
 	}
 
-	public void addStreet(int mapId, String name, int lblOffset, int strOff, Mdr5Record mdrCity) {
+	public void addStreet(int mapId, final String name, int lblOffset, ToIntFunction<String> createString,
+			Mdr5Record mdrCity) {
 		if (name.isEmpty())
 			return;
-			
+		
+		final int stopPos = checkMdr7Del(name);
+		if (stopPos == 0)
+			return;
+
 		// Find a name prefix, which is either a shield or a word ending 0x1e or 0x1c. We are treating
 		// a shield as a prefix of length one.
 		int prefix = 0;
@@ -97,6 +105,7 @@
 		if (prefix >= MAX_NAME_OFFSET || suffix >= MAX_NAME_OFFSET)
 			return;
 
+		final int strOff = createString.applyAsInt(name);
 		Mdr7Record st = new Mdr7Record();
 		st.setMapIndex(mapId);
 		st.setLabelOffset(lblOffset);
@@ -117,6 +126,8 @@
 		int outOffset = 0;
 
 		int end = Math.min(((suffix > 0) ? suffix : name.length()) - prefix - 1, MAX_NAME_OFFSET);
+		if (end > stopPos - prefix)
+			end = stopPos - prefix;
 		for (int nameOffset = 0; nameOffset < end; nameOffset += Character.charCount(c)) {
 			c = name.codePointAt(prefix + nameOffset);
 
@@ -154,6 +165,30 @@
 		}
 	}
 
+	private int checkMdr7Del(String name) {
+		int stopPos = Integer.MAX_VALUE;
+		if (!mdr7Del.isEmpty()) {
+			String[] parts = name.split(" ");
+			int pos = parts.length;
+			for (int i = parts.length - 1; i >= 0; i--) {
+				if (!mdr7Del.contains(parts[i])) {
+					break;
+				}
+				pos = i;
+			}
+			if (pos == 0)
+				return 0;
+			if (pos < parts.length) {
+				stopPos = 0;
+				for (int i = 0; i + 1 < pos; i++) {
+					stopPos += parts[i].length() + 1; // +1 for the blank
+				}
+				stopPos += parts[pos - 1].length();
+			}
+		}
+		return stopPos;
+	}
+
 	/**
 	 * Store in array if not already done
 	 * @param st the mdr7 record
