diff --git a/files.c b/files.c
index 2edf7ff534c82b4a4d1c4890e3c306c1f98f86c9..cc1fd4d5131400270000be4a93df05355c9b7aa3 100644
--- a/files.c
+++ b/files.c
@@ -252,10 +252,7 @@ int do_insertfile(void)
 	set_modified();
 
 	/* Here we want to rebuild the edit window */
-	for (i = 0, editbot = edittop;
-	     i <= editwinrows - 1
-	     && i <= totlines
-	     && editbot->next != NULL; editbot = editbot->next, i++);
+	fix_editbot();
 
 	/* If we've gone off the bottom, recenter, otherwise just redraw */
 	if (current->lineno > editbot->lineno)
diff --git a/nano.c b/nano.c
index 2acb52e3bdda6e646b6021c590ab2be8a1cde1e1..435648bd47eb91ef44bff996156ce464e77f8a81 100644
--- a/nano.c
+++ b/nano.c
@@ -502,19 +502,24 @@ int do_enter(filestruct * inptr)
     current = new;
     align(&current->data);
 
+    /* The logic here is as follows:
+     *    -> If we are at the bottom of the buffer, we want to recenter
+     *       (read: rebuild) the screen and forcably move the cursor.
+     *    -> otherwise, we want simply to redraw the screen and update
+     *       where we think the cursor is.
+     */
     if (current_y == editwinrows - 1) {
 	edit_update(current);
-
-	/* FIXME - figure out why the hell this is needed =) */
-	reset_cursor();
-    } else
+	reset_cursor(); 
+    } else {
 	current_y++;
+	edit_refresh();
+	update_cursor();
+    }
 
     totlines++;
     set_modified();
 
-    update_cursor();
-    edit_refresh();
     placewewant = xplustabs();
     return 1;
 }
@@ -1018,7 +1023,6 @@ void exit_spell(char *tmpfilename, char *foo)
  * This is Chris' very ugly spell function.  Someone please make this
  * better =-)
  */
-
 int do_spell(void)
 {
 #ifdef NANO_SMALL
@@ -1226,11 +1230,7 @@ void handle_sigwinch(int s)
 #endif				/* HAVE_WRESIZE */
 #endif				/* HAVE_NCURSES_H */
 
-    editbot = edittop;
-
-    for (i = 0; (i <= editwinrows - 1) && (editbot->next != NULL)
-	 && (editbot->next != filebot); i++)
-	editbot = editbot->next;
+    fix_editbot();
 
     if (current_y > editwinrows - 1) {
 	edit_update(editbot);
@@ -1428,17 +1428,11 @@ int do_justify(void)
 	edit_update(current);
 	center_cursor();
     } else {
-	int i = 0;
-
-	editbot = edittop;
-	for (i = 0; (i <= editwinrows - 1) && (editbot->next != NULL)
-	     && (editbot->next != filebot); i++)
-	    editbot = editbot->next;
+	fix_editbot();
     }
 
 
     edit_refresh();
-    edit_refresh();		/* XXX FIXME XXX */
     statusbar("Justify Complete");
     return 1;
 #else
diff --git a/proto.h b/proto.h
index 6d86025cef65860a214d40d4ca99503990295fb0..10da7ce537c0df3a0e202cd8d0928402c8254f84 100644
--- a/proto.h
+++ b/proto.h
@@ -86,6 +86,7 @@ void dump_buffer_reverse(filestruct * inptr);
 void reset_cursor(void);
 void check_statblank(void);
 void update_line(filestruct * fileptr, int index);
+void fix_editbot(void);
 void statusbar(char *msg, ...);
 void titlebar(void);
 void previous_line(void);
diff --git a/winio.c b/winio.c
index 0e981c82542f400eb4bab87ce543f86e0a4f1263..8869a765932c7cf465a154c00a80a3110f66766b 100644
--- a/winio.c
+++ b/winio.c
@@ -1257,3 +1257,12 @@ void dump_buffer_reverse(filestruct * inptr)
     }
 #endif				/* DEBUG */
 }
+
+/* Fix editbot based on the assumption that edittop is correct */
+void fix_editbot(void) {
+    int i;
+    editbot = edittop;
+    for(i = 0; (i <= editwinrows - 1) && (editbot->next != NULL)
+	&& (editbot != filebot); i++, editbot = editbot->next);
+}
+