Index: /trunk/lilypad/Sources/LPPrefsController.m
===================================================================
--- /trunk/lilypad/Sources/LPPrefsController.m (revision 251)
+++ /trunk/lilypad/Sources/LPPrefsController.m (revision 270)
@@ -494,24 +494,20 @@
 - (void)p_startObservingAccounts:(NSArray *)accounts
 {
-	NSEnumerator *accountEnum = [accounts objectEnumerator];
-	LPAccount *account;
-	while (account = [accountEnum nextObject]) {
-		[account addObserver:self forKeyPath:@"enabled" options:0 context:NULL];
-		[account addObserver:self forKeyPath:@"status" options:0 context:NULL];
-		[account addObserver:self forKeyPath:@"description" options:0 context:NULL];
-		[account addObserver:self forKeyPath:@"automaticReconnectionStatus" options:0 context:NULL];
-	}
+	NSIndexSet *indexSet = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [accounts count])];
+	
+	[accounts addObserver:self toObjectsAtIndexes:indexSet forKeyPath:@"enabled" options:0 context:NULL];
+	[accounts addObserver:self toObjectsAtIndexes:indexSet forKeyPath:@"status" options:0 context:NULL];
+	[accounts addObserver:self toObjectsAtIndexes:indexSet forKeyPath:@"description" options:0 context:NULL];
+	[accounts addObserver:self toObjectsAtIndexes:indexSet forKeyPath:@"automaticReconnectionStatus" options:0 context:NULL];
 }
 
 - (void)p_stopObservingAccounts:(NSArray *)accounts
 {
-	NSEnumerator *accountEnum = [accounts objectEnumerator];
-	LPAccount *account;
-	while (account = [accountEnum nextObject]) {
-		[account removeObserver:self forKeyPath:@"enabled"];
-		[account removeObserver:self forKeyPath:@"status"];
-		[account removeObserver:self forKeyPath:@"description"];
-		[account removeObserver:self forKeyPath:@"automaticReconnectionStatus"];
-	}
+	NSIndexSet *indexSet = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [accounts count])];
+	
+	[accounts removeObserver:self fromObjectsAtIndexes:indexSet forKeyPath:@"enabled"];
+	[accounts removeObserver:self fromObjectsAtIndexes:indexSet forKeyPath:@"status"];
+	[accounts removeObserver:self fromObjectsAtIndexes:indexSet forKeyPath:@"description"];
+	[accounts removeObserver:self fromObjectsAtIndexes:indexSet forKeyPath:@"automaticReconnectionStatus"];
 }
 
Index: /trunk/lilypad/Sources/LPRosterController.m
===================================================================
--- /trunk/lilypad/Sources/LPRosterController.m (revision 267)
+++ /trunk/lilypad/Sources/LPRosterController.m (revision 270)
@@ -246,14 +246,25 @@
 - (void)p_startObservingAccounts:(NSArray *)accounts
 {
+	NSIndexSet *indexSet = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [accounts count])];
+	
+	[accounts addObserver:self toObjectsAtIndexes:indexSet
+			   forKeyPath:@"enabled"
+				  options:0 context:LPAccountIDChangeContext];
+	[accounts addObserver:self toObjectsAtIndexes:indexSet
+			   forKeyPath:@"name"
+				  options:0 context:LPAccountIDChangeContext];
+	[accounts addObserver:self toObjectsAtIndexes:indexSet
+			   forKeyPath:@"JID"
+				  options:0 context:LPAccountIDChangeContext];
+	[accounts addObserver:self toObjectsAtIndexes:indexSet
+			   forKeyPath:@"pubManager.mainPubURL"
+				  options:0 context:LPPubChangeContext];
+	[accounts addObserver:self toObjectsAtIndexes:indexSet
+			   forKeyPath:@"pubManager.statusPhraseHTML"
+				  options:0 context:LPPubChangeContext];
+	
 	NSEnumerator *accountsEnum = [accounts objectEnumerator];
 	LPAccount *account;
-	
 	while (account = [accountsEnum nextObject]) {
-		[account addObserver:self forKeyPath:@"enabled" options:0 context:LPAccountIDChangeContext];
-		[account addObserver:self forKeyPath:@"name" options:0 context:LPAccountIDChangeContext];
-		[account addObserver:self forKeyPath:@"JID" options:0 context:LPAccountIDChangeContext];
-		[account addObserver:self forKeyPath:@"pubManager.mainPubURL" options:0 context:LPPubChangeContext];
-		[account addObserver:self forKeyPath:@"pubManager.statusPhraseHTML" options:0 context:LPPubChangeContext];
-		
 		[[NSNotificationCenter defaultCenter] addObserver:self
 												 selector:@selector(accountWillChangeStatus:)
@@ -265,15 +276,16 @@
 - (void)p_stopObservingAccounts:(NSArray *)accounts
 {
+	NSIndexSet *indexSet = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [accounts count])];
+	
+	[accounts removeObserver:self fromObjectsAtIndexes:indexSet forKeyPath:@"pubManager.statusPhraseHTML"];
+	[accounts removeObserver:self fromObjectsAtIndexes:indexSet forKeyPath:@"pubManager.mainPubURL"];
+	[accounts removeObserver:self fromObjectsAtIndexes:indexSet forKeyPath:@"JID"];
+	[accounts removeObserver:self fromObjectsAtIndexes:indexSet forKeyPath:@"name"];
+	[accounts removeObserver:self fromObjectsAtIndexes:indexSet forKeyPath:@"enabled"];
+	
 	NSEnumerator *accountsEnum = [accounts objectEnumerator];
 	LPAccount *account;
-	
 	while (account = [accountsEnum nextObject]) {
 		[[NSNotificationCenter defaultCenter] removeObserver:self name:LPAccountWillChangeStatusNotification object:account];
-		
-		[account removeObserver:self forKeyPath:@"pubManager.statusPhraseHTML"];
-		[account removeObserver:self forKeyPath:@"pubManager.mainPubURL"];
-		[account removeObserver:self forKeyPath:@"JID"];
-		[account removeObserver:self forKeyPath:@"name"];
-		[account removeObserver:self forKeyPath:@"enabled"];
 	}
 }
@@ -281,20 +293,18 @@
 - (void)p_startObservingGroups:(NSArray *)groups
 {
-	NSEnumerator *groupEnumerator = [groups objectEnumerator];
-	id group;
-	while (group = [groupEnumerator nextObject]) {
-		[group addObserver:self
-				forKeyPath:@"name"
-				   options:( NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld )
-				   context:LPRosterGroupPropertyChangeContext];
-		[group addObserver:self
-				forKeyPath:@"type"
-				   options:( NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld )
-				   context:LPRosterGroupPropertyChangeContext];
-		[group addObserver:self
-				forKeyPath:@"contacts"
-				   options:( NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld )
-				   context:LPRosterCollectionsChangeContext];
-	}
+	NSIndexSet *indexSet = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [groups count])];
+	
+	[groups addObserver:self toObjectsAtIndexes:indexSet
+			 forKeyPath:@"name"
+				options:( NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld )
+				context:LPRosterGroupPropertyChangeContext];
+	[groups addObserver:self toObjectsAtIndexes:indexSet
+			 forKeyPath:@"type"
+				options:( NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld )
+				context:LPRosterGroupPropertyChangeContext];
+	[groups addObserver:self toObjectsAtIndexes:indexSet
+			 forKeyPath:@"contacts"
+				options:( NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld )
+				context:LPRosterCollectionsChangeContext];
 }
 
@@ -302,11 +312,9 @@
 - (void)p_stopObservingGroups:(NSArray *)groups
 {
-	NSEnumerator *groupEnumerator = [groups objectEnumerator];
-	id group;
-	while (group = [groupEnumerator nextObject]) {
-		[group removeObserver:self forKeyPath:@"name"];
-		[group removeObserver:self forKeyPath:@"type"];
-		[group removeObserver:self forKeyPath:@"contacts"];
-	}
+	NSIndexSet *indexSet = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [groups count])];
+	
+	[groups removeObserver:self fromObjectsAtIndexes:indexSet forKeyPath:@"name"];
+	[groups removeObserver:self fromObjectsAtIndexes:indexSet forKeyPath:@"type"];
+	[groups removeObserver:self fromObjectsAtIndexes:indexSet forKeyPath:@"contacts"];
 }
 
@@ -314,12 +322,18 @@
 - (void)p_startObservingContacts:(NSArray *)contacts
 {
-	NSEnumerator *contactEnumerator = [contacts objectEnumerator];
-	id contact;
-	while (contact = [contactEnumerator nextObject]) {
-		[contact addObserver:self forKeyPath:@"name" options:0 context:LPRosterItemPropertyChangeContext];
-		[contact addObserver:self forKeyPath:@"avatar" options:0 context:LPRosterItemPropertyChangeContext];
-		[contact addObserver:self forKeyPath:@"status" options:NSKeyValueObservingOptionOld context:LPRosterItemPropertyChangeContext];
-		[contact addObserver:self forKeyPath:@"statusMessage" options:0 context:LPRosterItemPropertyChangeContext];
-	}
+	NSIndexSet *indexSet = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [contacts count])];
+	
+	[contacts addObserver:self toObjectsAtIndexes:indexSet
+			   forKeyPath:@"name"
+				  options:0 context:LPRosterItemPropertyChangeContext];
+	[contacts addObserver:self toObjectsAtIndexes:indexSet
+			   forKeyPath:@"avatar"
+				  options:0 context:LPRosterItemPropertyChangeContext];
+	[contacts addObserver:self toObjectsAtIndexes:indexSet
+			   forKeyPath:@"status"
+				  options:NSKeyValueObservingOptionOld context:LPRosterItemPropertyChangeContext];
+	[contacts addObserver:self toObjectsAtIndexes:indexSet
+			   forKeyPath:@"statusMessage"
+				  options:0 context:LPRosterItemPropertyChangeContext];
 }
 
@@ -327,12 +341,10 @@
 - (void)p_stopObservingContacts:(NSArray *)contacts
 {
-	NSEnumerator *contactEnumerator = [contacts objectEnumerator];
-	id contact;
-	while (contact = [contactEnumerator nextObject]) {
-		[contact removeObserver:self forKeyPath:@"name"];
-		[contact removeObserver:self forKeyPath:@"avatar"];
-		[contact removeObserver:self forKeyPath:@"status"];
-		[contact removeObserver:self forKeyPath:@"statusMessage"];
-	}
+	NSIndexSet *indexSet = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [contacts count])];
+	
+	[contacts removeObserver:self fromObjectsAtIndexes:indexSet forKeyPath:@"name"];
+	[contacts removeObserver:self fromObjectsAtIndexes:indexSet forKeyPath:@"avatar"];
+	[contacts removeObserver:self fromObjectsAtIndexes:indexSet forKeyPath:@"status"];
+	[contacts removeObserver:self fromObjectsAtIndexes:indexSet forKeyPath:@"statusMessage"];
 }
 
Index: /trunk/lilypad/Sources/LPEditContactController.m
===================================================================
--- /trunk/lilypad/Sources/LPEditContactController.m (revision 251)
+++ /trunk/lilypad/Sources/LPEditContactController.m (revision 270)
@@ -140,23 +140,12 @@
 - (void)p_startObservingEntries:(NSArray *)contactEntries
 {
-	NSEnumerator *entriesEnumerator = [contactEntries objectEnumerator];
-	LPContactEntry *entry;
-	
-	while (entry = [entriesEnumerator nextObject]) {
-		[entry addObserver:self
-				forKeyPath:@"allResourcesDescription"
-				   options:0
-				   context:NULL];
-	}
+	NSIndexSet *indexSet = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [contactEntries count])];
+	[contactEntries addObserver:self toObjectsAtIndexes:indexSet forKeyPath:@"allResourcesDescription" options:0 context:NULL];
 }
 
 - (void)p_stopObservingEntries:(NSArray *)contactEntries
 {
-	NSEnumerator *entriesEnumerator = [contactEntries objectEnumerator];
-	LPContactEntry *entry;
-	
-	while (entry = [entriesEnumerator nextObject]) {
-		[entry removeObserver:self forKeyPath:@"allResourcesDescription"];
-	}
+	NSIndexSet *indexSet = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [contactEntries count])];
+	[contactEntries removeObserver:self fromObjectsAtIndexes:indexSet forKeyPath:@"allResourcesDescription"];
 }
 
