[self addObject:info];
 }
 
+- (NSArray *) allInfoDictionaries {
+    return self;
+}
+
 @end
 
 @interface NSMutableDictionary (Cydia)
     [self setObject:info forKey:bundle];
 }
 
+- (NSArray *) allInfoDictionaries {
+    return [self allValues];
+}
+
 @end
 
 int main(int argc, const char *argv[]) {
 
         NSArray *cached([cache objectForKey:@"InfoPlistCachedKeys"]);
 
+        NSMutableSet *removed([NSMutableSet set]);
+        for (NSDictionary *info in [before allInfoDictionaries])
+            if (NSString *path = [info objectForKey:@"Path"])
+                [removed addObject:path];
+
         if (NSArray *apps = [manager contentsOfDirectoryAtPath:@"/Applications" error:&error]) {
             for (NSString *app in apps)
                 if ([app hasSuffix:@".app"]) {
                     if (NSMutableDictionary *info = [NSMutableDictionary dictionaryWithContentsOfFile:plist]) {
                         if (NSString *identifier = [info objectForKey:@"CFBundleIdentifier"]) {
                             [bundles setObject:path forKey:identifier];
+                            [removed removeObject:path];
 
                             if (cached != nil) {
                                 NSMutableDictionary *merged([before objectForKey:identifier]);
                 NSString *path([bundles objectForKey:identifier]);
                 [workspace registerApplication:[NSURL fileURLWithPath:path]];
             }
+
+            for (NSString *path in removed)
+                [workspace unregisterApplication:[NSURL fileURLWithPath:path]];
         }
     } else fprintf(stderr, "cannot open cache file. incorrect user?\n");
   cached: