<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -11,7 +11,7 @@
 
 @interface NSDocument (BDocumentAdditions)
 
-- (void)checkForModificationOfFileOnDisk;
+- (BOOL)checkForModificationOfFileOnDisk;
 
 @end
 </diff>
      <filename>BDocument.h</filename>
    </modified>
    <modified>
      <diff>@@ -308,6 +308,19 @@ static NSMutableArray *documentUserDefautlsArchive = nil;
 
 @synthesize fromSyncedDocument;
 
+- (void)saveDocumentWithDelegate:(id)delegate didSaveSelector:(SEL)didSaveSelector contextInfo:(void *)contextInfo {
+	if ([self checkForModificationOfFileOnDisk]) {
+		NSInvocation *callback = [NSInvocation invocationWithMethodSignature:[delegate methodSignatureForSelector:didSaveSelector]];
+		[callback setSelector:didSaveSelector];
+		[callback setArgument:&amp;self atIndex:2];
+		[callback setArgument:NO atIndex:3];
+		[callback setArgument:contextInfo atIndex:4];
+		[callback invokeWithTarget:delegate];
+		return;
+	}
+	[super saveDocumentWithDelegate:delegate didSaveSelector:didSaveSelector contextInfo:contextInfo];
+}
+
 - (BOOL)writeToURL:(NSURL *)absoluteURL ofType:(NSString *)typeName forSaveOperation:(NSSaveOperationType)saveOperation originalContentsURL:(NSURL *)absoluteOriginalContentsURL error:(NSError **)outError {
 	NSString *textContents = [self textContents];
 
@@ -322,43 +335,55 @@ static NSMutableArray *documentUserDefautlsArchive = nil;
 	return NO;
 }
 
-- (void)BDocument_checkForModificationOfFileOnDisk {
+- (BOOL)BDocument_checkForModificationOfFileOnDisk {
 	NSDate *knownFileModificationDate = [self fileModificationDate];
+	BOOL result = NO;
+	
 	if (knownFileModificationDate) {
-		NSDate *actualFileModificationDate = [[[NSFileManager defaultManager] fileAttributesAtPath:[[self fileURL] path] traverseLink:YES] fileModificationDate];
+		NSFileManager *fileManager = [NSFileManager defaultManager];
 		
-		if ([knownFileModificationDate isLessThan:actualFileModificationDate]) {
-			NSError *error = nil;
-			NSString *savedTextContents = [self savedTextContents:&amp;error];
-			if (savedTextContents) {
-				DiffMatchPatch *dmp = [[DiffMatchPatch alloc] init];
-				NSMutableArray *patches = [dmp patchMakeText1:lastKnownTextContentsOnDisk text2:savedTextContents];
-				if ([patches count] &gt; 0) {
-					NSArray *patchResults = [dmp patchApply:patches text:[self textContents]];
-					NSString *patchedDocumentText = [patchResults objectAtIndex:0];
-					[self setTextContents:patchedDocumentText];
-					
-					NSUInteger index = 0;
-					NSMutableArray *failedDiffs = [NSMutableArray array];
-					for (NSNumber *each in [patchResults objectAtIndex:1]) {
-						if ([each boolValue] == NO) {
-							[failedDiffs addObjectsFromArray:[[patches objectAtIndex:index] diffs]];
+		if ([fileManager fileExistsAtPath:[[self fileURL] path]]) {
+			if ([self respondsToSelector:@selector(_resetMoveAndRenameSensing)]) {
+				[self performSelector:@selector(_resetMoveAndRenameSensing)];
+			}
+			
+			NSDate *actualFileModificationDate = [[fileManager fileAttributesAtPath:[[self fileURL] path] traverseLink:YES] fileModificationDate];
+			
+			if ([knownFileModificationDate isLessThan:actualFileModificationDate]) {
+				NSError *error = nil;
+				NSString *savedTextContents = [self savedTextContents:&amp;error];
+				if (savedTextContents) {
+					DiffMatchPatch *dmp = [[DiffMatchPatch alloc] init];
+					NSMutableArray *patches = [dmp patchMakeText1:lastKnownTextContentsOnDisk text2:savedTextContents];
+					if ([patches count] &gt; 0) {
+						NSArray *patchResults = [dmp patchApply:patches text:[self textContents]];
+						NSString *patchedDocumentText = [patchResults objectAtIndex:0];
+						[self setTextContents:patchedDocumentText];
+						
+						NSUInteger index = 0;
+						NSMutableArray *failedDiffs = [NSMutableArray array];
+						for (NSNumber *each in [patchResults objectAtIndex:1]) {
+							if ([each boolValue] == NO) {
+								[failedDiffs addObjectsFromArray:[[patches objectAtIndex:index] diffs]];
+							}
+							index++;
+						}
+						
+						if ([failedDiffs count] &gt; 0) {
+							NSWindow *window = [[[self windowControllers] lastObject] window];
+							BDocumentDifferencesWindowController *differencesWindowController = [[BDocumentDifferencesWindowController alloc] initWithDiffs:failedDiffs];
+							[differencesWindowController setMessageText:BLocalizedString(@&quot;This document's file has been changed by another application. These changes could not be merged back into your open document.&quot;, nil)];
+							[NSApp beginSheet:[differencesWindowController window] modalForWindow:window modalDelegate:self didEndSelector:@selector(showMergeFailuresSheetDidEnd:returnCode:contextInfo:) contextInfo:nil];
+							result = YES;
 						}
-						index++;
 					}
 					
-					if ([failedDiffs count] &gt; 0) {
-						NSWindow *window = [[[self windowControllers] lastObject] window];
-						BDocumentDifferencesWindowController *differencesWindowController = [[BDocumentDifferencesWindowController alloc] initWithDiffs:failedDiffs];
-						[differencesWindowController setMessageText:BLocalizedString(@&quot;This document's file has been changed by another application. These changes could not be merged back into your open document.&quot;, nil)];
-						[NSApp beginSheet:[differencesWindowController window] modalForWindow:window modalDelegate:self didEndSelector:@selector(showMergeFailuresSheetDidEnd:returnCode:contextInfo:) contextInfo:nil];
-					}
+					[self setFileModificationDate:actualFileModificationDate];
 				}
-				
-				[self setFileModificationDate:actualFileModificationDate];
 			}
 		}
 	}
+	return result;
 }
 
 - (void)showMergeFailuresSheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo {
@@ -370,10 +395,11 @@ static NSMutableArray *documentUserDefautlsArchive = nil;
 
 @implementation NSDocument (BDocumentAdditions)
 
-- (void)checkForModificationOfFileOnDisk {
+- (BOOL)checkForModificationOfFileOnDisk {
 	if ([self respondsToSelector:@selector(BDocument_checkForModificationOfFileOnDisk)]) {
-		[self performSelector:@selector(BDocument_checkForModificationOfFileOnDisk)];
+		return [((id)self) BDocument_checkForModificationOfFileOnDisk];
 	}
+	return NO;
 }
 
 @end</diff>
      <filename>BDocument.m</filename>
    </modified>
    <modified>
      <diff>@@ -41,6 +41,11 @@
 	//	[self setPrimitiveValue:@&quot;jesse&quot; forKey:@&quot;name&quot;];
 }
 
+- (void)willSave {
+	[super willSave];
+	[self setPrimitiveValue:[NSDate date] forKey:@&quot;modified&quot;];
+}
+
 @dynamic name;
 
 - (NSString *)displayName {</diff>
      <filename>SyncedDocument.m</filename>
    </modified>
    <modified>
      <diff>@@ -120,7 +120,7 @@
 	NSError *error;
     NSURL *storeUrl = [NSURL fileURLWithPath:[[self documentDatabaseDirectory] stringByAppendingPathComponent:@&quot;SyncedDocuments.coredata&quot;]];
 	
-	[[NSFileManager defaultManager] removeItemAtPath:[storeUrl path] error:nil];
+	//[[NSFileManager defaultManager] removeItemAtPath:[storeUrl path] error:nil];
 	
     persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:[self managedObjectModel]];
     if (![persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeUrl options:nil error:&amp;error]) {</diff>
      <filename>SyncedDocumentsController.m</filename>
    </modified>
    <modified>
      <diff>@@ -14,11 +14,11 @@
 
 + (id)sharedInstance;
 + (BOOL)isSyncedDocumentURL:(NSURL *)url;
-+ (SyncedDocument *)syncedDocumentForCacheURL:(NSURL *)url;
-+ (NSURL *)cacheURLForSyncedDocument:(SyncedDocument *)syncedDocument;
++ (SyncedDocument *)syncedDocumentForEditableFileURL:(NSURL *)url;
++ (NSURL *)editableFileURLForSyncedDocument:(SyncedDocument *)syncedDocument;
 + (NSString *)displayNameForSyncedDocument:(NSURL *)url;
 + (NSString *)syncedDocumentsFolder;
-+ (NSString *)syncedDocumentsCacheDirectory;
++ (NSString *)syncedDocumentsEditableFilesFolder;
 + (NSDictionary *)localFileAttributes;
 	
 @end
@@ -66,3 +66,5 @@
 - (IBAction)cancel:(id)sender;
 
 @end
+
+APPKIT_EXTERN NSString *SyncedDocumentsFolderKey;</diff>
      <filename>SyncedDocumentsControllerDelegate.h</filename>
    </modified>
    <modified>
      <diff>@@ -15,6 +15,12 @@
 
 @implementation SyncedDocumentsControllerDelegate
 
++ (void)initialize {
+	[[NSUserDefaults standardUserDefaults] registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys:
+															 [[[NSFileManager defaultManager] processesApplicationSupportFolder] stringByAppendingPathComponent:[[SyncedDocumentsController sharedInstance] serviceLabel]], SyncedDocumentsFolderKey,
+															 nil]];
+}
+
 + (id)sharedInstance {
     static id sharedInstance = nil;
     if (sharedInstance == nil) {
@@ -24,20 +30,21 @@
 }
 
 + (BOOL)isSyncedDocumentURL:(NSURL *)url {
-	NSString *documentPath = [url path];
-	NSString *documentIDPath = [documentPath stringByDeletingLastPathComponent];
-	NSString *documentCacheDirectory = [documentIDPath stringByDeletingLastPathComponent];
-	return [[self syncedDocumentsCacheDirectory] isEqualToString:documentCacheDirectory];
+	return [[url path] rangeOfString:[self syncedDocumentsEditableFilesFolder]].location == 0;
 }
 
-+ (SyncedDocument *)syncedDocumentForCacheURL:(NSURL *)url {
++ (SyncedDocument *)syncedDocumentForEditableFileURL:(NSURL *)url {
 	SyncedDocumentsController *syncedDocumentsController = [SyncedDocumentsController sharedInstance];
 	NSURL *URIRepresentation = [NSURL URLWithString:[NSString stringWithFormat:@&quot;x-coredata://%@&quot;, [[[[url path] stringByDeletingLastPathComponent] lastPathComponent] stringByReplacingOccurrencesOfString:@&quot;_&quot; withString:@&quot;/&quot;]]];
 	NSManagedObjectID *objectID = [syncedDocumentsController.persistentStoreCoordinator managedObjectIDForURIRepresentation:URIRepresentation];
-	return (id) [syncedDocumentsController.managedObjectContext objectWithID:objectID];
+	if (objectID) {
+		return (id) [syncedDocumentsController.managedObjectContext objectWithID:objectID];
+	} else {
+		return nil;
+	}
 }
 
-+ (NSString *)cacheFilenameForSyncedDocument:(SyncedDocument *)syncedDocument {
++ (NSString *)validFilenameForSyncedDocument:(SyncedDocument *)syncedDocument {
 	NSString *name = syncedDocument.displayName;
 	name = [name stringByReplacingOccurrencesOfString:@&quot;/&quot; withString:@&quot;-&quot;];	
 	if ([name isEqualToString:@&quot;.&quot;] || [name isEqualToString:@&quot;..&quot;]) {
@@ -49,30 +56,40 @@
 	return name;
 }
 
-+ (NSURL *)cacheURLForSyncedDocument:(SyncedDocument *)syncedDocument {
++ (NSURL *)editableFileURLForSyncedDocument:(SyncedDocument *)syncedDocument {
 	NSURL *URIRepresentation = [[syncedDocument objectID] URIRepresentation];
 	NSString *normalizedPath = [[URIRepresentation path] stringByReplacingOccurrencesOfString:@&quot;/&quot; withString:@&quot;_&quot;];
-	return [NSURL fileURLWithPath:[[NSString stringWithFormat:@&quot;%@/%@%@&quot;, [self syncedDocumentsCacheDirectory], [URIRepresentation host], normalizedPath] stringByAppendingPathComponent:[self cacheFilenameForSyncedDocument:syncedDocument]]];
+	return [NSURL fileURLWithPath:[[NSString stringWithFormat:@&quot;%@/%@%@&quot;, [self syncedDocumentsEditableFilesFolder], [URIRepresentation host], normalizedPath] stringByAppendingPathComponent:[self validFilenameForSyncedDocument:syncedDocument]]];
 }
 
 + (NSString *)displayNameForSyncedDocument:(NSURL *)url {
-	return [[[url path] lastPathComponent] stringByDeletingPathExtension];
+	SyncedDocument *syncedDocument = [self syncedDocumentForEditableFileURL:url];
+	NSDate *syncModificationDate = syncedDocument.modified;
+	NSDate *localModificationDate = [[[NSFileManager defaultManager] fileAttributesAtPath:[url path] traverseLink:YES] objectForKey:NSFileModificationDate];
+	int difference = abs(floor([syncModificationDate timeIntervalSinceDate:localModificationDate]));
+	
+	if (difference &gt; 0) {
+		return [NSString stringWithFormat:@&quot;%@ (Sync)&quot;, syncedDocument.name];
+		//return [NSString stringWithFormat:@&quot;%@ (&#8634;)&quot;, syncedDocument.name];
+	} else {
+		return syncedDocument.name;
+	}
 }
 
 + (NSString *)syncedDocumentsFolder {
 	NSFileManager *fileManager = [NSFileManager defaultManager];
-	NSString *syncedDocumentsFolder = [fileManager.processesApplicationSupportFolder stringByAppendingPathComponent:[[SyncedDocumentsController sharedInstance] serviceLabel]];
+	NSString *syncedDocumentsFolder = [[NSUserDefaults standardUserDefaults] objectForKey:SyncedDocumentsFolderKey];
 	if ([fileManager createDirectoriesForPath:syncedDocumentsFolder]) {
 		return syncedDocumentsFolder;
 	}
 	return nil;
 }
 
-+ (NSString *)syncedDocumentsCacheDirectory {
++ (NSString *)syncedDocumentsEditableFilesFolder {
 	NSFileManager *fileManager = [NSFileManager defaultManager];
-	NSString *syncedDocumentsCacheDirectory = [[self syncedDocumentsFolder] stringByAppendingPathComponent:@&quot;SyncedDocumentsCacheDirectory&quot;];
-	if ([fileManager createDirectoriesForPath:syncedDocumentsCacheDirectory]) {
-		return syncedDocumentsCacheDirectory;
+	NSString *syncedDocumentsEditableFiles = [[self syncedDocumentsFolder] stringByAppendingPathComponent:@&quot;SyncedDocumentsEditableFiles&quot;];
+	if ([fileManager createDirectoriesForPath:syncedDocumentsEditableFiles]) {
+		return syncedDocumentsEditableFiles;
 	}
 	return nil;
 }
@@ -140,7 +157,7 @@
 			NSBeep();
 			BLogError([error description]);
 		} else {
-			[[NSDocumentController sharedDocumentController] openDocumentWithContentsOfURL:[SyncedDocumentsControllerDelegate cacheURLForSyncedDocument:newDocument] display:YES error:&amp;error];
+			[[NSDocumentController sharedDocumentController] openDocumentWithContentsOfURL:[SyncedDocumentsControllerDelegate editableFileURLForSyncedDocument:newDocument] display:YES error:&amp;error];
 		}
 	}
 }
@@ -165,7 +182,7 @@
 	if (returnCode == NSOKButton) {
 		NSError *error = nil;
 		BDocument *document = [windowController document];
-		SyncedDocument *syncedDocument = [SyncedDocumentsControllerDelegate syncedDocumentForCacheURL:[document fileURL]];
+		SyncedDocument *syncedDocument = [SyncedDocumentsControllerDelegate syncedDocumentForEditableFileURL:[document fileURL]];
 		
 		if (syncedDocument) {
 			[document saveDocument:nil];
@@ -225,15 +242,15 @@
 		
 		for (SyncedDocument *eachSyncedDocument in [syncedDocumentsController documents:&amp;error]) {
 			if (![eachSyncedDocument.userDeleted boolValue]) {
-				NSURL *eachCacheURL = [SyncedDocumentsControllerDelegate cacheURLForSyncedDocument:eachSyncedDocument];
+				NSURL *eachEditableFileURL = [SyncedDocumentsControllerDelegate editableFileURLForSyncedDocument:eachSyncedDocument];
 				if (!addedSeparator) {
 					addedSeparator = YES;
 					[menuItems addObject:[NSMenuItem separatorItem]];
 				}
 				
-				NSMenuItem *eachMenuItem = [[NSMenuItem alloc] initWithTitle:[SyncedDocumentsControllerDelegate displayNameForSyncedDocument:eachCacheURL] action:@selector(openSyncedDocument:) keyEquivalent:@&quot;&quot;];
-				[eachMenuItem setRepresentedObject:eachCacheURL];
-				NSImage *icon = [workspace iconForFile:[eachCacheURL path]];
+				NSMenuItem *eachMenuItem = [[NSMenuItem alloc] initWithTitle:[SyncedDocumentsControllerDelegate displayNameForSyncedDocument:eachEditableFileURL] action:@selector(openSyncedDocument:) keyEquivalent:@&quot;&quot;];
+				[eachMenuItem setRepresentedObject:eachEditableFileURL];
+				NSImage *icon = [workspace iconForFile:[eachEditableFileURL path]];
 				[icon setSize:NSMakeSize(16, 16)];
 				[eachMenuItem setImage:icon];
 				[eachMenuItem setTarget:self];
@@ -285,13 +302,13 @@
 	}
 	
 	for (SyncedDocument *eachSyncedDocument in syncedDocuments) {
-		NSString *eachCachePath = [[SyncedDocumentsControllerDelegate cacheURLForSyncedDocument:eachSyncedDocument] path];
+		NSString *eachEditableFilePath = [[SyncedDocumentsControllerDelegate editableFileURLForSyncedDocument:eachSyncedDocument] path];
 		
-		if ([fileManager fileExistsAtPath:eachCachePath isDirectory:&amp;isDirectory] &amp;&amp; !isDirectory) {
-			NSString *localCacheContent = [NSString stringWithContentsOfFile:eachCachePath encoding:NSUTF8StringEncoding error:&amp;error];
-			if (localCacheContent) {
-				if (![eachSyncedDocument.content isEqualToString:localCacheContent]) {
-					eachSyncedDocument.content = localCacheContent;
+		if ([fileManager fileExistsAtPath:eachEditableFilePath isDirectory:&amp;isDirectory] &amp;&amp; !isDirectory) {
+			NSString *editableFileContent = [NSString stringWithContentsOfFile:eachEditableFilePath encoding:NSUTF8StringEncoding error:&amp;error];
+			if (editableFileContent) {
+				if (![eachSyncedDocument.content isEqualToString:editableFileContent]) {
+					eachSyncedDocument.content = editableFileContent;
 				}
 			} else {
 				BLogError([error description]);
@@ -345,17 +362,17 @@
 	}
 }
 
-- (BOOL)deleteLocalCacheFor:(SyncedDocument *)syncedDocument {
+- (BOOL)deleteEditableFileForSyncedDocument:(SyncedDocument *)syncedDocument {
 	NSError *error = nil;
 	NSFileManager *fileManager = [NSFileManager defaultManager];
-	NSURL *eachCacheURL = [SyncedDocumentsControllerDelegate cacheURLForSyncedDocument:syncedDocument];
-	NSDocument *eachDocument = [[NSDocumentController sharedDocumentController] documentForURL:eachCacheURL];
+	NSURL *eachEditableFileURL = [SyncedDocumentsControllerDelegate editableFileURLForSyncedDocument:syncedDocument];
+	NSDocument *eachDocument = [[NSDocumentController sharedDocumentController] documentForURL:eachEditableFileURL];
 	if (eachDocument) {
 		[eachDocument saveDocument:nil];
 		[eachDocument close];
 	}
-	if ([fileManager fileExistsAtPath:[eachCacheURL path]]) {
-		if (![fileManager removeItemAtPath:[[eachCacheURL path] stringByDeletingLastPathComponent] error:&amp;error]) {
+	if ([fileManager fileExistsAtPath:[eachEditableFileURL path]]) {
+		if (![fileManager removeItemAtPath:[[eachEditableFileURL path] stringByDeletingLastPathComponent] error:&amp;error]) {
 			return NO;
 		}
 	}
@@ -364,47 +381,58 @@
 
 - (void)syncedDocumentsManagedObjectContextDidSave:(NSNotification *)notification {
 	NSFileManager *fileManager = [NSFileManager defaultManager];
+	NSMutableDictionary *localFileAttributes = [[SyncedDocumentsControllerDelegate localFileAttributes] mutableCopy];
 	
 	for (SyncedDocument *eachInserted in [[notification userInfo] objectForKey:NSInsertedObjectsKey]) {
-		NSURL *eachCacheURL = [SyncedDocumentsControllerDelegate cacheURLForSyncedDocument:eachInserted];
+		NSURL *eachEditableFileURL = [SyncedDocumentsControllerDelegate editableFileURLForSyncedDocument:eachInserted];
 		
-		if (![fileManager createDirectoriesForPath:[[eachCacheURL path] stringByDeletingLastPathComponent]]) {
+		if (![fileManager createDirectoriesForPath:[[eachEditableFileURL path] stringByDeletingLastPathComponent]]) {
 			BLogError(@&quot;&quot;);
 		}
+
+		[localFileAttributes setObject:eachInserted.modified forKey:NSFileModificationDate];
 		
-		if (![fileManager createFileAtPath:[eachCacheURL path] contents:[eachInserted.content dataUsingEncoding:NSUTF8StringEncoding] attributes:[SyncedDocumentsControllerDelegate localFileAttributes]]) {
+		if (![fileManager createFileAtPath:[eachEditableFileURL path] contents:[eachInserted.content dataUsingEncoding:NSUTF8StringEncoding] attributes:localFileAttributes]) {
 			BLogError(@&quot;&quot;);
 		}
 	}
 
 	for (SyncedDocument *eachUpdated in [[notification userInfo] objectForKey:NSUpdatedObjectsKey]) {
 		if ([eachUpdated.userDeleted boolValue]) {
-			if (![self deleteLocalCacheFor:eachUpdated]) {
+			if (![self deleteEditableFileForSyncedDocument:eachUpdated]) {
 				BLogError(@&quot;&quot;);
 			}
 		} else {
-			NSURL *eachCacheURL = [SyncedDocumentsControllerDelegate cacheURLForSyncedDocument:eachUpdated];
-			NSDocument *eachDocument = [[NSDocumentController sharedDocumentController] documentForURL:eachCacheURL];
+			NSURL *eachEditableFileURL = [SyncedDocumentsControllerDelegate editableFileURLForSyncedDocument:eachUpdated];
+			NSDocument *eachDocument = [[NSDocumentController sharedDocumentController] documentForURL:eachEditableFileURL];
 			
-			if (![fileManager createFileAtPath:[eachCacheURL path] contents:[eachUpdated.content dataUsingEncoding:NSUTF8StringEncoding] attributes:[SyncedDocumentsControllerDelegate localFileAttributes]]) {
+			if (![fileManager createDirectoriesForPath:[[eachEditableFileURL path] stringByDeletingLastPathComponent]]) {
+				BLogError(@&quot;&quot;);
+			}
+			
+			[localFileAttributes setObject:eachUpdated.modified forKey:NSFileModificationDate];
+
+			if (![fileManager createFileAtPath:[eachEditableFileURL path] contents:[eachUpdated.content dataUsingEncoding:NSUTF8StringEncoding] attributes:localFileAttributes]) {
 				BLogError(@&quot;&quot;);
 			}
 			
 			if (eachDocument) {
-				if (![[eachDocument fileURL] isEqual:eachCacheURL]) {
-					[eachDocument setFileURL:eachCacheURL];
+				if (![[eachDocument fileURL] isEqual:eachEditableFileURL]) {
+					[eachDocument setFileURL:eachEditableFileURL];
 					if ([eachDocument respondsToSelector:@selector(_resetMoveAndRenameSensing)]) {
 						[eachDocument performSelector:@selector(_resetMoveAndRenameSensing)];
 					}
 				}
 				[eachDocument checkForModificationOfFileOnDisk];
-				[eachDocument saveDocument:nil];
+				[eachDocument saveDocument:nil];				
+				[fileManager setAttributes:localFileAttributes ofItemAtPath:[eachEditableFileURL path] error:NULL];
+				[[eachDocument windowControllers] makeObjectsPerformSelector:@selector(synchronizeWindowTitleWithDocumentName)];
 			}
 	
-			NSString *eachCacheURLFolderPath = [[eachCacheURL path] stringByDeletingLastPathComponent];
-			for (NSString *eachFilename in [fileManager contentsOfDirectoryAtPath:eachCacheURLFolderPath error:nil]) {
-				NSString *eachPath = [eachCacheURLFolderPath stringByAppendingPathComponent:eachFilename];
-				if (![eachPath isEqualToString:[eachCacheURL path]]) {
+			NSString *eachEditableFileURLFolderPath = [[eachEditableFileURL path] stringByDeletingLastPathComponent];
+			for (NSString *eachFilename in [fileManager contentsOfDirectoryAtPath:eachEditableFileURLFolderPath error:nil]) {
+				NSString *eachPath = [eachEditableFileURLFolderPath stringByAppendingPathComponent:eachFilename];
+				if (![eachPath isEqualToString:[eachEditableFileURL path]]) {
 					[fileManager removeItemAtPath:eachPath error:nil]; // delete old files in case of rename.
 				}
 			}
@@ -412,7 +440,7 @@
 	}
 
 	for (SyncedDocument *eachDeleted in [[notification userInfo] objectForKey:NSDeletedObjectsKey]) {
-		if (![self deleteLocalCacheFor:eachDeleted]) {
+		if (![self deleteEditableFileForSyncedDocument:eachDeleted]) {
 			BLogError(@&quot;&quot;);
 		}
 	}
@@ -562,4 +590,6 @@
 	[progressIndicator stopAnimation:nil];
 }
 
-@end
\ No newline at end of file
+@end
+
+NSString *SyncedDocumentsFolderKey = @&quot;SyncedDocumentsFolderKey&quot;;
\ No newline at end of file</diff>
      <filename>SyncedDocumentsControllerDelegate.m</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>6883bb9e2b64f4588f48d68857d25f73483a271c</id>
    </parent>
  </parents>
  <author>
    <name>Jesse Grosjean</name>
    <email>jesse@hogbaysoftware.com</email>
  </author>
  <url>http://github.com/jessegrosjean/bdocuments/commit/01499aef3a93a7ffa79bdd30b612975ead2d3c15</url>
  <id>01499aef3a93a7ffa79bdd30b612975ead2d3c15</id>
  <committed-date>2009-05-04T13:12:28-07:00</committed-date>
  <authored-date>2009-05-04T13:12:28-07:00</authored-date>
  <message>better handling of modified documents</message>
  <tree>5a07f081c3a33323faa65a5f796bdbac4a67c9a0</tree>
  <committer>
    <name>Jesse Grosjean</name>
    <email>jesse@hogbaysoftware.com</email>
  </committer>
</commit>
