diff --git a/transverse-field-ising-model-tfd.c b/transverse-field-ising-model-tfd.c
index 8431fb5e8b480ef6243db2066636a2d48cec3b03..a05c2edf226c13d7ef5284eb1a78c5e2b2e7faed 100644
--- a/transverse-field-ising-model-tfd.c
+++ b/transverse-field-ising-model-tfd.c
@@ -885,7 +885,7 @@ int find_results(void)
 
     rc = sqlite3_open(DBPATH, &db);
     if(rc) {
-        fprintf(stderr, "\n100: Can't open database: %s\n", sqlite3_errmsg(db));
+        fprintf(stderr, "\nError: Can't open database in %s:%i: %s\n", __FILE__, __LINE__, sqlite3_errmsg(db));
         exit(EX_SOFTWARE);
     }
 
@@ -905,7 +905,7 @@ int find_results(void)
         "(N, gamma_i, gamma_f, nStates, t, lfi))", NULL, 0, &zErrMsg);
     if(rc != SQLITE_OK)
     {
-        fprintf(stderr, "\n101: SQL error %i: %s\n", rc, zErrMsg);
+        fprintf(stderr, "\nSQL error %i in %s:%i: %s\n", rc, __FILE__, __LINE__, zErrMsg);
         sqlite3_free(zErrMsg);
         exit(EX_SOFTWARE);
     }
@@ -914,56 +914,56 @@ int find_results(void)
         "AND gamma_f = ?3 AND nStates = ?4 AND t = ?5 AND lfi = ?6;", -1, &stmt, NULL);
     if(rc != SQLITE_OK)
     {
-        fprintf(stderr, "\n102: SQL error %i: %s\n", rc, sqlite3_errmsg(db));
+        fprintf(stderr, "\nSQL error %i in %s:%i: %s\n", rc, __FILE__, __LINE__, sqlite3_errmsg(db));
         exit(EX_SOFTWARE);
     }
 
     rc = sqlite3_bind_int(stmt, 1, N);
     if(rc != SQLITE_OK)
     {
-        fprintf(stderr, "\n103: SQL error %i: %s\n", rc, sqlite3_errmsg(db));
+        fprintf(stderr, "\nSQL error %i in %s:%i: %s\n", rc, __FILE__, __LINE__, sqlite3_errmsg(db));
         exit(EX_SOFTWARE);
     }
 
     rc = sqlite3_bind_double(stmt, 2, Gamma_i);
     if(rc != SQLITE_OK)
     {
-        fprintf(stderr, "\n104: SQL error %i: %s\n", rc, sqlite3_errmsg(db));
+        fprintf(stderr, "\nSQL error %i in %s:%i: %s\n", rc, __FILE__, __LINE__, sqlite3_errmsg(db));
         exit(EX_SOFTWARE);
     }
 
     rc = sqlite3_bind_double(stmt, 3, Gamma_f);
     if(rc != SQLITE_OK)
     {
-        fprintf(stderr, "\n105: SQL error %i: %s\n", rc, sqlite3_errmsg(db));
+        fprintf(stderr, "\nSQL error %i in %s:%i: %s\n", rc, __FILE__, __LINE__, sqlite3_errmsg(db));
         exit(EX_SOFTWARE);
     }
 
     rc = sqlite3_bind_int(stmt, 4, nStates);
     if(rc != SQLITE_OK)
     {
-        fprintf(stderr, "\n106: SQL error %i: %s\n", rc, sqlite3_errmsg(db));
+        fprintf(stderr, "\nSQL error %i in %s:%i: %s\n", rc, __FILE__, __LINE__, sqlite3_errmsg(db));
         exit(EX_SOFTWARE);
     }
 
     rc = sqlite3_bind_double(stmt, 5, t);
     if(rc != SQLITE_OK)
     {
-        fprintf(stderr, "\n107: SQL error %i: %s\n", rc, sqlite3_errmsg(db));
+        fprintf(stderr, "\nSQL error %i in %s:%i: %s\n", rc, __FILE__, __LINE__, sqlite3_errmsg(db));
         exit(EX_SOFTWARE);
     }
 
     rc = sqlite3_bind_double(stmt, 6, lfi);
     if(rc != SQLITE_OK)
     {
-        fprintf(stderr, "\n108: SQL error %i: %s\n", rc, sqlite3_errmsg(db));
+        fprintf(stderr, "\nSQL error %i in %s:%i: %s\n", rc, __FILE__, __LINE__, sqlite3_errmsg(db));
         exit(EX_SOFTWARE);
     }
 
     rc = sqlite3_step(stmt);
     if(rc != SQLITE_ROW)
     {
-        fprintf(stderr, "\n109: SQL error %i: %s\n", rc, sqlite3_errmsg(db));
+        fprintf(stderr, "\nSQL error %i in %s:%i: %s\n", rc, __FILE__, __LINE__, sqlite3_errmsg(db));
         exit(EX_SOFTWARE);
     }
     
@@ -971,19 +971,19 @@ int find_results(void)
 
     rc = sqlite3_reset(stmt);
     if(rc != SQLITE_OK) {
-        fprintf(stderr, "\n110: SQL error %i: %s\n", rc, sqlite3_errmsg(db));
+        fprintf(stderr, "\nSQL error %i in %s:%i: %s\n", rc, __FILE__, __LINE__, sqlite3_errmsg(db));
         exit(EX_SOFTWARE);
     }
 
     rc = sqlite3_finalize(stmt);
     if(rc != SQLITE_OK) {
-        fprintf(stderr, "\n111: SQL error %i: %s\n", rc, sqlite3_errmsg(db));
+        fprintf(stderr, "\nSQL error %i in %s:%i: %s\n", rc, __FILE__, __LINE__, sqlite3_errmsg(db));
         exit(EX_SOFTWARE);
     }
 
     rc = sqlite3_close(db);
     if(rc != SQLITE_OK) {
-        fprintf(stderr, "\n112: SQL error %i: %s\n\n", rc, sqlite3_errmsg(db));
+        fprintf(stderr, "\nSQL error %i in %s:%i: %s\n", rc, __FILE__, __LINE__, sqlite3_errmsg(db));
         exit(EX_SOFTWARE);
     }
 
@@ -1021,7 +1021,7 @@ void store_results(void)
         "(N, gamma_i, gamma_f, nStates, t, lfi))", NULL, 0, &zErrMsg);
     if(rc != SQLITE_OK)
     {
-        fprintf(stderr, "\n129: SQL error %i: %s\n", rc, zErrMsg);
+        fprintf(stderr, "\nSQL error %i in %s:%i: %s\n", rc, __FILE__, __LINE__, zErrMsg);
         sqlite3_free(zErrMsg);
         exit(EX_SOFTWARE);
     }
@@ -1037,188 +1037,188 @@ void store_results(void)
         -1, &stmt, NULL);
     if(rc != SQLITE_OK)
     {
-        fprintf(stderr, "\n130: SQL error %i: %s\n", rc, sqlite3_errmsg(db));
+        fprintf(stderr, "\nSQL error %i in %s:%i: %s\n", rc, __FILE__, __LINE__, zErrMsg);
         exit(EX_SOFTWARE);
     }
 
     rc = sqlite3_bind_int(stmt, 1, N);
     if(rc != SQLITE_OK)
     {
-        fprintf(stderr, "\n131: SQL error %i: %s\n", rc, sqlite3_errmsg(db));
+        fprintf(stderr, "\nSQL error %i in %s:%i: %s\n", rc, __FILE__, __LINE__, sqlite3_errmsg(db));
         exit(EX_SOFTWARE);
     }
 
     rc = sqlite3_bind_double(stmt, 2, Gamma_i);
     if(rc != SQLITE_OK)
     {
-        fprintf(stderr, "\n132: SQL error %i: %s\n", rc, sqlite3_errmsg(db));
+        fprintf(stderr, "\nSQL error %i in %s:%i: %s\n", rc, __FILE__, __LINE__, sqlite3_errmsg(db));
         exit(EX_SOFTWARE);
     }
 
     rc = sqlite3_bind_double(stmt, 3, Gamma_f);
     if(rc != SQLITE_OK)
     {
-        fprintf(stderr, "\n133: SQL error %i: %s\n", rc, sqlite3_errmsg(db));
+        fprintf(stderr, "\nSQL error %i in %s:%i: %s\n", rc, __FILE__, __LINE__, sqlite3_errmsg(db));
         exit(EX_SOFTWARE);
     }
 
     rc = sqlite3_bind_int(stmt, 4, nStates);
     if(rc != SQLITE_OK)
     {
-        fprintf(stderr, "\n134: SQL error %i: %s\n", rc, sqlite3_errmsg(db));
+        fprintf(stderr, "\nSQL error %i in %s:%i: %s\n", rc, __FILE__, __LINE__, sqlite3_errmsg(db));
         exit(EX_SOFTWARE);
     }
 
     rc = sqlite3_bind_double(stmt, 5, t);
     if(rc != SQLITE_OK)
     {
-        fprintf(stderr, "\n135: SQL error %i: %s\n", rc, sqlite3_errmsg(db));
+        fprintf(stderr, "\nSQL error %i in %s:%i: %s\n", rc, __FILE__, __LINE__, sqlite3_errmsg(db));
         exit(EX_SOFTWARE);
     }
 
     rc = sqlite3_bind_double(stmt, 6, lfi);
     if(rc != SQLITE_OK)
     {
-        fprintf(stderr, "\n136: SQL error %i: %s\n", rc, sqlite3_errmsg(db));
+        fprintf(stderr, "\nSQL error %i in %s:%i: %s\n", rc, __FILE__, __LINE__, sqlite3_errmsg(db));
         exit(EX_SOFTWARE);
     }
 
     rc = sqlite3_bind_double(stmt, 7, magnetization);
     if(rc != SQLITE_OK)
     {
-        fprintf(stderr, "\n137: SQL error %i: %s\n", rc, sqlite3_errmsg(db));
+        fprintf(stderr, "\nSQL error %i in %s:%i: %s\n", rc, __FILE__, __LINE__, sqlite3_errmsg(db));
         exit(EX_SOFTWARE);
     }
 
     rc = sqlite3_bind_double(stmt, 8, magnetization_err);
     if(rc != SQLITE_OK)
     {
-        fprintf(stderr, "\n138: SQL error %i: %s\n", rc, sqlite3_errmsg(db));
+        fprintf(stderr, "\nSQL error %i in %s:%i: %s\n", rc, __FILE__, __LINE__, sqlite3_errmsg(db));
         exit(EX_SOFTWARE);
     }
 
     rc = sqlite3_bind_double(stmt, 9, magnetization_C_mean);
     if(rc != SQLITE_OK)
     {
-        fprintf(stderr, "\n139: SQL error %i: %s\n", rc, sqlite3_errmsg(db));
+        fprintf(stderr, "\nSQL error %i in %s:%i: %s\n", rc, __FILE__, __LINE__, sqlite3_errmsg(db));
         exit(EX_SOFTWARE);
     }
 
     rc = sqlite3_bind_double(stmt, 10, magnetization_C_variance);
     if(rc != SQLITE_OK)
     {
-        fprintf(stderr, "\n140: SQL error %i: %s\n", rc, sqlite3_errmsg(db));
+        fprintf(stderr, "\nSQL error %i in %s:%i: %s\n", rc, __FILE__, __LINE__, sqlite3_errmsg(db));
         exit(EX_SOFTWARE);
     }
 
     rc = sqlite3_bind_double(stmt, 11, magnetization_C_skewness);
     if(rc != SQLITE_OK)
     {
-        fprintf(stderr, "\n141: SQL error %i: %s\n", rc, sqlite3_errmsg(db));
+        fprintf(stderr, "\nSQL error %i in %s:%i: %s\n", rc, __FILE__, __LINE__, sqlite3_errmsg(db));
         exit(EX_SOFTWARE);
     }
 
     rc = sqlite3_bind_double(stmt, 12, magnetization_C_kurtosis);
     if(rc != SQLITE_OK)
     {
-        fprintf(stderr, "\n142: SQL error %i: %s\n", rc, sqlite3_errmsg(db));
+        fprintf(stderr, "\nSQL error %i in %s:%i: %s\n", rc, __FILE__, __LINE__, sqlite3_errmsg(db));
         exit(EX_SOFTWARE);
     }
 
     rc = sqlite3_bind_double(stmt, 13, S_A);
     if(rc != SQLITE_OK)
     {
-        fprintf(stderr, "\n143: SQL error %i: %s\n", rc, sqlite3_errmsg(db));
+        fprintf(stderr, "\nSQL error %i in %s:%i: %s\n", rc, __FILE__, __LINE__, sqlite3_errmsg(db));
         exit(EX_SOFTWARE);
     }
 
     rc = sqlite3_bind_double(stmt, 14, S_AB);
     if(rc != SQLITE_OK)
     {
-        fprintf(stderr, "\n144: SQL error %i: %s\n", rc, sqlite3_errmsg(db));
+        fprintf(stderr, "\nSQL error %i in %s:%i: %s\n", rc, __FILE__, __LINE__, sqlite3_errmsg(db));
         exit(EX_SOFTWARE);
     }
 
     rc = sqlite3_bind_double(stmt, 15, S_AC);
     if(rc != SQLITE_OK)
     {
-        fprintf(stderr, "\n145: SQL error %i: %s\n", rc, sqlite3_errmsg(db));
+        fprintf(stderr, "\nSQL error %i in %s:%i: %s\n", rc, __FILE__, __LINE__, sqlite3_errmsg(db));
         exit(EX_SOFTWARE);
     }
 
     rc = sqlite3_bind_double(stmt, 16, S_C);
     if(rc != SQLITE_OK)
     {
-        fprintf(stderr, "\n146: SQL error %i: %s\n", rc, sqlite3_errmsg(db));
+        fprintf(stderr, "\nSQL error %i in %s:%i: %s\n", rc, __FILE__, __LINE__, sqlite3_errmsg(db));
         exit(EX_SOFTWARE);
     }
 
     rc = sqlite3_bind_double(stmt, 17, S2_A);
     if(rc != SQLITE_OK)
     {
-        fprintf(stderr, "\n147: SQL error %i: %s\n", rc, sqlite3_errmsg(db));
+        fprintf(stderr, "\nSQL error %i in %s:%i: %s\n", rc, __FILE__, __LINE__, sqlite3_errmsg(db));
         exit(EX_SOFTWARE);
     }
 
     rc = sqlite3_bind_double(stmt, 18, S2_AB);
     if(rc != SQLITE_OK)
     {
-        fprintf(stderr, "\n148: SQL error %i: %s\n", rc, sqlite3_errmsg(db));
+        fprintf(stderr, "\nSQL error %i in %s:%i: %s\n", rc, __FILE__, __LINE__, sqlite3_errmsg(db));
         exit(EX_SOFTWARE);
     }
 
     rc = sqlite3_bind_double(stmt, 19, S2_AC);
     if(rc != SQLITE_OK)
     {
-        fprintf(stderr, "\n149: SQL error %i: %s\n", rc, sqlite3_errmsg(db));
+        fprintf(stderr, "\nSQL error %i in %s:%i: %s\n", rc, __FILE__, __LINE__, sqlite3_errmsg(db));
         exit(EX_SOFTWARE);
     }
 
     rc = sqlite3_bind_double(stmt, 20, S2_C);
     if(rc != SQLITE_OK)
     {
-        fprintf(stderr, "\n150: SQL error %i: %s\n", rc, sqlite3_errmsg(db));
+        fprintf(stderr, "\nSQL error %i in %s:%i: %s\n", rc, __FILE__, __LINE__, sqlite3_errmsg(db));
         exit(EX_SOFTWARE);
     }
 
     rc = sqlite3_bind_double(stmt, 21, Smin_A);
     if(rc != SQLITE_OK)
     {
-        fprintf(stderr, "\n151: SQL error %i: %s\n", rc, sqlite3_errmsg(db));
+        fprintf(stderr, "\nSQL error %i in %s:%i: %s\n", rc, __FILE__, __LINE__, sqlite3_errmsg(db));
         exit(EX_SOFTWARE);
     }
 
     rc = sqlite3_bind_double(stmt, 22, Smin_AB);
     if(rc != SQLITE_OK)
     {
-        fprintf(stderr, "\n152: SQL error %i: %s\n", rc, sqlite3_errmsg(db));
+        fprintf(stderr, "\nSQL error %i in %s:%i: %s\n", rc, __FILE__, __LINE__, sqlite3_errmsg(db));
         exit(EX_SOFTWARE);
     }
 
     rc = sqlite3_bind_double(stmt, 23, Smin_AC);
     if(rc != SQLITE_OK)
     {
-        fprintf(stderr, "\n153: SQL error %i: %s\n", rc, sqlite3_errmsg(db));
+        fprintf(stderr, "\nSQL error %i in %s:%i: %s\n", rc, __FILE__, __LINE__, sqlite3_errmsg(db));
         exit(EX_SOFTWARE);
     }
 
     rc = sqlite3_bind_double(stmt, 24, Smin_C);
     if(rc != SQLITE_OK)
     {
-        fprintf(stderr, "\n154: SQL error %i: %s\n", rc, sqlite3_errmsg(db));
+        fprintf(stderr, "\nSQL error %i in %s:%i: %s\n", rc, __FILE__, __LINE__, sqlite3_errmsg(db));
         exit(EX_SOFTWARE);
     }
 
     rc = sqlite3_bind_text(stmt, 25, GIT_DESCRIBE, sizeof(GIT_DESCRIBE), SQLITE_STATIC);
     if(rc != SQLITE_OK)
     {
-        fprintf(stderr, "\n155: SQL error %i: %s\n", rc, sqlite3_errmsg(db));
+        fprintf(stderr, "\nSQL error %i in %s:%i: %s\n", rc, __FILE__, __LINE__, sqlite3_errmsg(db));
         exit(EX_SOFTWARE);
     }
 
     rc = sqlite3_step(stmt);
     if(rc != SQLITE_OK && rc != SQLITE_DONE) {
-        fprintf(stderr, "\n156: SQL error %i: %s\n", rc, sqlite3_errmsg(db));
+        fprintf(stderr, "\nSQL error %i in %s:%i: %s\n", rc, __FILE__, __LINE__, sqlite3_errmsg(db));
         if(rc == SQLITE_CONSTRAINT)
         {
             sqlite3_finalize(stmt);
@@ -1230,19 +1230,19 @@ void store_results(void)
 
     rc = sqlite3_reset(stmt);
     if(rc != SQLITE_OK) {
-        fprintf(stderr, "\n157: SQL error %i: %s\n", rc, sqlite3_errmsg(db));
+        fprintf(stderr, "\nSQL error %i in %s:%i: %s\n", rc, __FILE__, __LINE__, sqlite3_errmsg(db));
         exit(EX_SOFTWARE);
     }
 
     rc = sqlite3_finalize(stmt);
     if(rc != SQLITE_OK) {
-        fprintf(stderr, "\n158: SQL error %i: %s\n", rc, sqlite3_errmsg(db));
+        fprintf(stderr, "\nSQL error %i in %s:%i: %s\n", rc, __FILE__, __LINE__, sqlite3_errmsg(db));
         exit(EX_SOFTWARE);
     }
 
     rc = sqlite3_close(db);
     if(rc != SQLITE_OK) {
-        fprintf(stderr, "\n159: SQL error %i: %s\n\n", rc, sqlite3_errmsg(db));
+        fprintf(stderr, "\nSQL error %i in %s:%i: %s\n", rc, __FILE__, __LINE__, sqlite3_errmsg(db));
         exit(EX_SOFTWARE);
     }
 }