diff --git a/core/divelist.c b/core/divelist.c
index 320713bc7..c25a29c16 100644
--- a/core/divelist.c
+++ b/core/divelist.c
@@ -29,7 +29,6 @@
  * dive_trip_t *combine_trips_create(struct dive_trip *trip_a, struct dive_trip *trip_b)
  * struct dive *unregister_dive(int idx)
  * void delete_single_dive(int idx)
- * void add_dive_to_table(struct dive_table *table, int idx, struct dive *dive)
  * void add_single_dive(int idx, struct dive *dive)
  * void select_dive(struct dive *dive)
  * void deselect_dive(struct dive *dive)
@@ -872,6 +871,20 @@ struct dive *last_selected_dive()
 	return ret;
 }
 
+/* add a dive at the given index to a dive table. */
+static void add_to_dive_table(struct dive_table *table, int idx, struct dive *dive)
+{
+	int i;
+	grow_dive_table(table);
+	table->nr++;
+
+	for (i = idx; i < table->nr; i++) {
+		struct dive *tmp = table->dives[i];
+		table->dives[i] = dive;
+		dive = tmp;
+	}
+}
+
 static void unregister_dive_from_table(struct dive_table *table, int idx)
 {
 	int i;
@@ -910,11 +923,13 @@ void remove_dive_from_trip(struct dive *dive)
  * from trip beforehand. */
 void add_dive_to_trip(struct dive *dive, dive_trip_t *trip)
 {
+	int idx;
 	if (dive->divetrip == trip)
 		return;
 	if (dive->divetrip)
 		fprintf(stderr, "Warning: adding dive to trip that has trip set\n");
-	add_dive_to_table(&trip->dives, -1, dive);
+	idx = dive_get_insertion_index(&trip->dives, dive);
+	add_to_dive_table(&trip->dives, idx, dive);
 	dive->divetrip = trip;
 }
 
@@ -1131,29 +1146,12 @@ int dive_get_insertion_index(struct dive_table *table, struct dive *dive)
 	return table->nr;
 }
 
-/* add a dive at the given index to a dive table. if the index is negative,
- * the dive will be added according to dive_less_than() order */
-void add_dive_to_table(struct dive_table *table, int idx, struct dive *dive)
-{
-	int i;
-	if (idx < 0)
-		idx = dive_get_insertion_index(table, dive);
-	grow_dive_table(table);
-	table->nr++;
-
-	for (i = idx; i < table->nr; i++) {
-		struct dive *tmp = table->dives[i];
-		table->dives[i] = dive;
-		dive = tmp;
-	}
-}
-
 /* add a dive at the given index in the global dive table and keep track
  * of the number of selected dives. if the index is negative, the dive will
  * be added according to dive_less_than() order */
 void add_single_dive(int idx, struct dive *dive)
 {
-	add_dive_to_table(&dive_table, idx, dive);
+	add_to_dive_table(&dive_table, idx, dive);
 	if (dive->selected)
 		amount_selected++;
 }
diff --git a/core/divelist.h b/core/divelist.h
index 620de42d8..aca2ed21e 100644
--- a/core/divelist.h
+++ b/core/divelist.h
@@ -23,7 +23,6 @@ extern char *get_dive_gas_string(const struct dive *dive);
 
 extern struct dive **grow_dive_table(struct dive_table *table);
 extern int dive_get_insertion_index(struct dive_table *table, struct dive *dive);
-extern void add_dive_to_table(struct dive_table *table, int idx, struct dive *dive);
 extern void add_single_dive(int idx, struct dive *dive);
 extern void get_dive_gas(const struct dive *dive, int *o2_p, int *he_p, int *o2low_p);
 extern int get_divenr(const struct dive *dive);
diff --git a/qt-models/divelistmodel.cpp b/qt-models/divelistmodel.cpp
index e3934b604..6edb69705 100644
--- a/qt-models/divelistmodel.cpp
+++ b/qt-models/divelistmodel.cpp
@@ -278,7 +278,7 @@ QString DiveListModel::startAddDive()
 	nr++;
 	d->number = nr;
 	d->dc.model = strdup("manually added dive");
-	add_single_dive(-1, d);
+	add_single_dive(dive_table.nr, d);
 	insertDive(get_idx_by_uniq_id(d->id), new DiveObjectHelper(d));
 	return QString::number(d->id);
 }