Index: src/uk/me/parabola/mkgmap/reader/osm/ElementSaver.java
===================================================================
--- src/uk/me/parabola/mkgmap/reader/osm/ElementSaver.java	(revision 4196)
+++ src/uk/me/parabola/mkgmap/reader/osm/ElementSaver.java	(working copy)
@@ -108,7 +108,7 @@
 	}
 
 	/**
-	 * Add the given node and save it. The node should have tags.
+	 * Add the given node and save it. The node should have tags, if not it should be a member of a relation.
 	 *
 	 * @param node The osm node.
 	 */
Index: src/uk/me/parabola/mkgmap/reader/osm/OsmMapDataSource.java
===================================================================
--- src/uk/me/parabola/mkgmap/reader/osm/OsmMapDataSource.java	(revision 4196)
+++ src/uk/me/parabola/mkgmap/reader/osm/OsmMapDataSource.java	(working copy)
@@ -61,6 +61,8 @@
 	private static final Logger log = Logger.getLogger(OsmMapDataSource.class);
 
 	private Style style;
+	
+	// attention, the order of the hooks is important!
 	private final OsmReadingHooks[] POSSIBLE_HOOKS = {
 			new SeaGenerator(),
 			new MultiPolygonFinishHook(),
Index: src/uk/me/parabola/mkgmap/reader/osm/UnusedElementsRemoverHook.java
===================================================================
--- src/uk/me/parabola/mkgmap/reader/osm/UnusedElementsRemoverHook.java	(revision 4196)
+++ src/uk/me/parabola/mkgmap/reader/osm/UnusedElementsRemoverHook.java	(working copy)
@@ -15,12 +15,9 @@
 
 import java.awt.Rectangle;
 import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map.Entry;
-import java.util.Set;
-
 import uk.me.parabola.imgfmt.app.Area;
 import uk.me.parabola.imgfmt.app.Coord;
 import uk.me.parabola.log.Logger;
@@ -28,7 +25,7 @@
 
 /**
  * The hook removes all elements that will not be included in the map and can therefore
- * be safely removed. This improves the performance because the elements does not have
+ * be safely removed. This improves the performance because the elements do not have
  * to go through the style system. 
  * 
  * @author WanMil
@@ -39,7 +36,7 @@
 	private ElementSaver saver;
 	
 	/** node with tags of this list must not be removed */
-	private Collection<String> nodeTagBlacklist;
+	private Tags nodeTagBlacklist;
 
 	public UnusedElementsRemoverHook() {
 	}
@@ -51,10 +48,10 @@
 		// where the POI is placed in polygons. They must not be removed if the polygon
 		// is not removed. Checking if the polygon is not removed is too costly therefore
 		// all nodes with these tags are kept.
-		nodeTagBlacklist = new HashSet<String>();
+		nodeTagBlacklist = new Tags(); 
 		List<Entry<String,String>> areasToPoiNodeTags = POIGeneratorHook.getPoiPlacementTags(props);
 		for (Entry<String,String> nodeTags : areasToPoiNodeTags) {
-			nodeTagBlacklist.add(nodeTags.getKey());
+			nodeTagBlacklist.put(nodeTags.getKey(), nodeTags.getValue());
 		}
 		
 		return true;
@@ -82,16 +79,18 @@
 				boolean removeNode = true;
 				
 				// check if the node has no tag of the blacklist
-				if (nodeTagBlacklist.isEmpty() == false) {
-					for (String tag : nodeTagBlacklist ) {
-						if (node.getTag(tag) != null) {
-							// the node contains one tag that might be interesting for the POIGeneratorHook
-							// do not remove it
-							removeNode = false;
-							break;
-						}
+				Iterator<Entry<Short, String>> iter = nodeTagBlacklist.entryShortIterator();
+				while (iter.hasNext()) {
+					Entry<Short, String> tag = iter.next();
+					if (tag.getValue().equals(node.getTag(tag.getKey()))) {
+						// the node contains one tag that might be interesting for the POIGeneratorHook
+						// do not remove it
+						removeNode = false;
+						break;
 					}
+
 				}
+
 				if (removeNode) {
 					saver.getNodes().remove(node.getId());
 				} else {
@@ -100,22 +99,7 @@
 			}
 		}
 		
-		long tr1 = System.currentTimeMillis();
-		
-		// store all way ids that are referenced by a relation
-		// all tags without a tag must not be removed if they are referenced by a relation
-		Set<Long> relationWays = new HashSet<Long>();
-		for (Relation rel : saver.getRelations().values()) {
-			for (Entry<String, Element> relEntry : rel.getElements()) {
-				if (relEntry.getValue() instanceof Way) {
-					relationWays.add(relEntry.getValue().getId());
-				}
-			}
-		}
-		log.debug("Collecting way ids from relations took", (System.currentTimeMillis()-tr1), "ms");
-		
 		Rectangle bboxRect = new Rectangle(bbox.getMinLong(), bbox.getMinLat(), bbox.getWidth(), bbox.getHeight());
-		long relWays = 0;
 		long ways = saver.getWays().size();
 		for (Way way : new ArrayList<Way>(saver.getWays().values())) {
 			if (way.getPoints().isEmpty()) {
@@ -124,15 +108,11 @@
 				continue;
 			}
 			
-			// check if a way has no tags and is not a member of a relation
-			// a relation might be used to add tags to the way using the style file
+			// check if a way has no tags
+			// it is presumed that the RelationStyleHook was already executed
 			if (way.getTagCount() == 0) {
-				if (relationWays.contains(way.getId())) {
-					relWays++;
-				} else {
-					saver.getWays().remove(way.getId());
-					continue;
-				}
+				saver.getWays().remove(way.getId());
+				continue;
 			}
 			
 			// check if the way is completely outside the tile bounding box
@@ -183,7 +163,7 @@
 				// no coord of the way is within the bounding box
 				// check if the way possibly covers the bounding box completely
 				Area wayBbox = new Area(minLat, minLong, maxLat, maxLong);
-				if (wayBbox.intersects(saver.getBoundingBox())) {
+				if (wayBbox.contains(saver.getBoundingBox())) {
 					log.debug(way, "possibly covers the bbox completely. Keep it.", way.toTagString());
 				} else {
 					saver.getWays().remove(way.getId());
@@ -191,7 +171,6 @@
 			} 
 		}
 		
-		log.info("Relation referenced ways:", relationWays.size(), "Used:", relWays);
 		log.info("Nodes: before:", nodes, "after:", saver.getNodes().size());	
 		log.info("Ways: before:", ways, "after:", saver.getWays().size());	
 		log.info("Removing unused elements took", (System.currentTimeMillis()-t1), "ms");
