diff --git a/ChangeLog b/ChangeLog
index b77818b0dafc808ec66704eff7dc46eebeda12e8..f9be1ce9fe98f551eb1dcfdff713f6a2ef3282e9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,8 @@ CVS code -
 	  backup_lines(). (DLR)
 	- Reorder some functions for consistency. (DLR)
 	- Rename variable open_files openfile, for consistency. (DLR)
+	- Remove renumber()'s dependency on the main filestruct.
+	  Changes to renumber(); removal of renumber_all(). (DLR)
 	- Restructure things so that every file has its own
 	  openfilestruct, and so that the values in it are used directly
 	  instead of being periodically synced up with the globals.
diff --git a/src/files.c b/src/files.c
index 61771239a1b2354ada8cdb72e6dd768668e23ca3..2d07ea3dd3f235a2bf561cef4b07b0a75e0d3f04 100644
--- a/src/files.c
+++ b/src/files.c
@@ -165,13 +165,13 @@ void open_buffer(const char *filename)
     }
 #endif
 
+    /* Open the file. */
+    rc = open_file(filename, new_buffer, &f);
+
     /* If we're loading into a new buffer, add a new openfile entry. */
     if (new_buffer)
 	make_new_buffer();
 
-    /* Open the file. */
-    rc = open_file(filename, new_buffer, &f);
-
     /* If we have a file and we're loading into a new buffer, update the
      * filename. */
     if (rc != -1 && new_buffer)
@@ -545,7 +545,7 @@ int open_file(const char *filename, bool newfie, FILE **f)
 	statusbar(_("\"%s\" not found"), filename);
 	return -1;
     } else if (S_ISDIR(fileinfo.st_mode) || S_ISCHR(fileinfo.st_mode) ||
-		S_ISBLK(fileinfo.st_mode)) {
+	S_ISBLK(fileinfo.st_mode)) {
 	/* Don't open character or block files.  Sorry, /dev/sndstat! */
 	statusbar(S_ISDIR(fileinfo.st_mode) ?
 		_("\"%s\" is a directory") :
diff --git a/src/nano.c b/src/nano.c
index 390aefaf9e0ccac134dbd82f4dc381345e2f540a..08cc340df7b5e957880f86d0baa6d3dc7fcb52ab 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -179,32 +179,19 @@ void free_filestruct(filestruct *src)
     delete_node(src);
 }
 
-/* Renumber all entries in the main filestruct. */
-void renumber_all(void)
+/* Renumbers all entries in a filestruct, starting with fileptr. */
+void renumber(filestruct *fileptr)
 {
-    filestruct *temp;
-    ssize_t line = 1;
+    ssize_t line;
 
-    assert(openfile->fileage == NULL || openfile->fileage != openfile->fileage->next);
+    assert(fileptr != NULL && fileptr->prev != NULL);
 
-    for (temp = openfile->fileage; temp != NULL; temp = temp->next)
-	temp->lineno = line++;
-}
+    line = (fileptr->prev == NULL) ? 1 : fileptr->prev->lineno;
 
-/* Renumbers all entries in the main filestruct, starting with
- * fileptr. */
-void renumber(filestruct *fileptr)
-{
-    if (fileptr == NULL || fileptr->prev == NULL || fileptr == openfile->fileage)
-	renumber_all();
-    else {
-	ssize_t line = fileptr->prev->lineno;
-
-	assert(fileptr != fileptr->next);
+    assert(fileptr != fileptr->next);
 
-	for (; fileptr != NULL; fileptr = fileptr->next)
-	    fileptr->lineno = ++line;
-    }
+    for (; fileptr != NULL; fileptr = fileptr->next)
+	fileptr->lineno = ++line;
 }
 
 /* Partition a filestruct so it begins at (top, top_x) and ends at (bot,
diff --git a/src/proto.h b/src/proto.h
index 1f953d4171eff46b1c058ff5ad6dd49be1d78e42..938e3371f5bb5dbea9c703fe754abacac21a8ee6 100644
--- a/src/proto.h
+++ b/src/proto.h
@@ -348,7 +348,6 @@ void unlink_node(const filestruct *fileptr);
 void delete_node(filestruct *fileptr);
 filestruct *copy_filestruct(const filestruct *src);
 void free_filestruct(filestruct *src);
-void renumber_all(void);
 void renumber(filestruct *fileptr);
 partition *partition_filestruct(filestruct *top, size_t top_x,
 	filestruct *bot, size_t bot_x);
diff --git a/src/search.c b/src/search.c
index 3a793374e1cde9da5514c9b00406f807db8fb515..2ae55457a13ce0714ad46d534e84c7474995577a 100644
--- a/src/search.c
+++ b/src/search.c
@@ -953,7 +953,7 @@ void do_replace(void)
     openfile->current_x = beginx;
     openfile->placewewant = pww_save;
 
-    renumber_all();
+    renumber(openfile->fileage);
     edit_refresh();
 
     if (numreplaced >= 0)
diff --git a/src/winio.c b/src/winio.c
index fe5bc2481226f1a30bea2222bef3fdb68db126c0..81b6bc78df14cc192b84da70cb366a5ff921623e 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -3063,7 +3063,7 @@ void reset_cursor(void)
 {
     /* If we haven't opened any files yet, put the cursor in the top
      * left corner of the edit window and get out. */
-    if (openfile->edittop == NULL || openfile->current == NULL) {
+    if (openfile == NULL) {
 	wmove(edit, 0, 0);
 	return;
     }