diff --git a/include/cgimap/api06/changeset_close_handler.hpp b/include/cgimap/api06/changeset_close_handler.hpp
index ee9d47e1..3e34f827 100644
--- a/include/cgimap/api06/changeset_close_handler.hpp
+++ b/include/cgimap/api06/changeset_close_handler.hpp
@@ -20,9 +20,11 @@ namespace api06 {
 
 class changeset_close_responder : public text_responder {
 public:
-  changeset_close_responder(mime::type, data_update &, osm_changeset_id_t,
-                             const std::string &,
-                             std::optional<osm_user_id_t>);
+  changeset_close_responder(mime::type, 
+                            data_update &, 
+                            osm_changeset_id_t,
+                            const std::string &,
+                            std::optional<osm_user_id_t>);
 };
 
 class changeset_close_handler : public payload_enabled_handler {
@@ -33,7 +35,7 @@ class changeset_close_handler : public payload_enabled_handler {
   responder_ptr_t responder(data_selection &x) const override;
 
   responder_ptr_t responder(data_update &,
-			    const std::string &payload,
+                            const std::string &payload,
                             std::optional<osm_user_id_t> user_id) const override;
   bool requires_selection_after_update() const override;
 
diff --git a/include/cgimap/api06/changeset_create_handler.hpp b/include/cgimap/api06/changeset_create_handler.hpp
index d3cdd255..9488a111 100644
--- a/include/cgimap/api06/changeset_create_handler.hpp
+++ b/include/cgimap/api06/changeset_create_handler.hpp
@@ -20,7 +20,8 @@ namespace api06 {
 
 class changeset_create_responder : public text_responder {
 public:
-  changeset_create_responder(mime::type, data_update &,
+  changeset_create_responder(mime::type, 
+                             data_update &,
                              const std::string &,
                              std::optional<osm_user_id_t>);
 };
@@ -33,7 +34,7 @@ class changeset_create_handler : public payload_enabled_handler {
   responder_ptr_t responder(data_selection &x) const override;
 
   responder_ptr_t responder(data_update &,
-			    const std::string &payload,
+                            const std::string &payload,
                             std::optional<osm_user_id_t> user_id) const override;
   bool requires_selection_after_update() const override;
 };
diff --git a/include/cgimap/api06/changeset_update_handler.hpp b/include/cgimap/api06/changeset_update_handler.hpp
index 17bb51d5..bd845a67 100644
--- a/include/cgimap/api06/changeset_update_handler.hpp
+++ b/include/cgimap/api06/changeset_update_handler.hpp
@@ -22,17 +22,17 @@ namespace api06 {
 class changeset_update_responder : public text_responder {
 public:
   changeset_update_responder(mime::type,
-			     data_update &,
-			     osm_changeset_id_t id_,
+                             data_update &,
+                             osm_changeset_id_t id_,
                              const std::string & payload,
-			     std::optional<osm_user_id_t> user_id);
+                             std::optional<osm_user_id_t> user_id);
 };
 
 class changeset_update_sel_responder : public osm_current_responder {
 public:
   changeset_update_sel_responder(mime::type,
-			     data_selection & sel,
-			     osm_changeset_id_t id_);
+                                 data_selection & sel,
+                                 osm_changeset_id_t id_);
 private:
   data_selection& sel;
 };
@@ -45,7 +45,7 @@ class changeset_update_handler : public payload_enabled_handler {
   responder_ptr_t responder(data_selection &x) const override;
 
   responder_ptr_t responder(data_update &,
-			    const std::string &payload,
+                            const std::string &payload,
                             std::optional<osm_user_id_t> user_id) const override;
   bool requires_selection_after_update() const override;
 
diff --git a/include/cgimap/api06/changeset_upload/node.hpp b/include/cgimap/api06/changeset_upload/node.hpp
index ad10836c..8fd0d2cb 100644
--- a/include/cgimap/api06/changeset_upload/node.hpp
+++ b/include/cgimap/api06/changeset_upload/node.hpp
@@ -10,7 +10,7 @@
 #ifndef NODE_HPP
 #define NODE_HPP
 
-#include "osmobject.hpp"
+#include "cgimap/api06/changeset_upload/osmobject.hpp"
 
 #include <iostream>
 #include <optional>
diff --git a/include/cgimap/api06/changeset_upload/node_updater.hpp b/include/cgimap/api06/changeset_upload/node_updater.hpp
index 3659401c..1914d3ce 100644
--- a/include/cgimap/api06/changeset_upload/node_updater.hpp
+++ b/include/cgimap/api06/changeset_upload/node_updater.hpp
@@ -16,7 +16,6 @@
 #include "cgimap/api06/changeset_upload/osmchange_tracking.hpp"
 
 #include <map>
-#include <set>
 #include <string>
 
 
diff --git a/include/cgimap/api06/changeset_upload/osmchange_tracking.hpp b/include/cgimap/api06/changeset_upload/osmchange_tracking.hpp
index 233ebcdf..fe269836 100644
--- a/include/cgimap/api06/changeset_upload/osmchange_tracking.hpp
+++ b/include/cgimap/api06/changeset_upload/osmchange_tracking.hpp
@@ -11,7 +11,6 @@
 #define OSMCHANGE_TRACKING_HPP
 
 #include <map>
-#include <set>
 #include <string>
 #include <vector>
 
diff --git a/include/cgimap/api06/changeset_upload/parser_callback.hpp b/include/cgimap/api06/changeset_upload/parser_callback.hpp
index 61597f39..e690121e 100644
--- a/include/cgimap/api06/changeset_upload/parser_callback.hpp
+++ b/include/cgimap/api06/changeset_upload/parser_callback.hpp
@@ -22,6 +22,7 @@ namespace api06 {
 class Parser_Callback {
 
 public:
+  virtual ~Parser_Callback() = default;
 
   virtual void start_document() = 0;
 
@@ -32,8 +33,6 @@ class Parser_Callback {
   virtual void process_way(const Way &, operation op, bool if_unused) = 0;
 
   virtual void process_relation(const Relation &, operation op, bool if_unused) = 0;
-
-  virtual ~Parser_Callback() = default;
 };
 
 } // namespace api06
diff --git a/include/cgimap/api06/changeset_upload/relation.hpp b/include/cgimap/api06/changeset_upload/relation.hpp
index 6d0baa4d..5ae2012f 100644
--- a/include/cgimap/api06/changeset_upload/relation.hpp
+++ b/include/cgimap/api06/changeset_upload/relation.hpp
@@ -10,7 +10,7 @@
 #ifndef RELATION_HPP
 #define RELATION_HPP
 
-#include "osmobject.hpp"
+#include "cgimap/api06/changeset_upload/osmobject.hpp"
 #include "cgimap/types.hpp"
 #include "cgimap/util.hpp"
 
@@ -26,7 +26,9 @@ class RelationMember {
   RelationMember() = default;
 
   RelationMember(const std::string &m_type, osm_nwr_signed_id_t m_ref, const std::string &m_role) :
-    m_role(m_role), m_ref(m_ref), m_type(m_type) {};
+    m_role(m_role), 
+    m_ref(m_ref), 
+    m_type(m_type) {}
 
   void set_type(const std::string &type) {
 
diff --git a/include/cgimap/api06/changeset_upload/relation_updater.hpp b/include/cgimap/api06/changeset_upload/relation_updater.hpp
index 16c913be..f02439e7 100644
--- a/include/cgimap/api06/changeset_upload/relation_updater.hpp
+++ b/include/cgimap/api06/changeset_upload/relation_updater.hpp
@@ -17,7 +17,6 @@
 #include "cgimap/api06/changeset_upload/relation.hpp"
 
 #include <map>
-#include <set>
 #include <string>
 #include <vector>
 
diff --git a/include/cgimap/api06/changeset_upload/way_updater.hpp b/include/cgimap/api06/changeset_upload/way_updater.hpp
index 6dc630fe..ec161362 100644
--- a/include/cgimap/api06/changeset_upload/way_updater.hpp
+++ b/include/cgimap/api06/changeset_upload/way_updater.hpp
@@ -16,12 +16,10 @@
 #include "cgimap/api06/changeset_upload/osmchange_tracking.hpp"
 
 #include <map>
-#include <set>
 #include <string>
 #include <vector>
 
 
-
 namespace api06 {
 
 using TagList = std::map<std::string, std::string>;
@@ -36,15 +34,20 @@ class Way_Updater {
   virtual ~Way_Updater() = default;
 
   virtual void add_way(osm_changeset_id_t changeset_id,
-                       osm_nwr_signed_id_t old_id, const WayNodeList &nodes,
+                       osm_nwr_signed_id_t old_id, 
+                       const WayNodeList &nodes,
                        const TagList &tags) = 0;
 
-  virtual void modify_way(osm_changeset_id_t changeset_id, osm_nwr_id_t id,
-                          osm_version_t version, const WayNodeList &nodes,
+  virtual void modify_way(osm_changeset_id_t changeset_id, 
+                          osm_nwr_id_t id,
+                          osm_version_t version, 
+                          const WayNodeList &nodes,
                           const TagList &tags) = 0;
 
-  virtual void delete_way(osm_changeset_id_t changeset_id, osm_nwr_id_t id,
-                          osm_version_t version, bool if_unused) = 0;
+  virtual void delete_way(osm_changeset_id_t changeset_id, 
+                          osm_nwr_id_t id,
+                          osm_version_t version, 
+                          bool if_unused) = 0;
 
   virtual void process_new_ways() = 0;
 
diff --git a/include/cgimap/api06/changeset_upload_handler.hpp b/include/cgimap/api06/changeset_upload_handler.hpp
index 4f741c5e..0d7e58df 100644
--- a/include/cgimap/api06/changeset_upload_handler.hpp
+++ b/include/cgimap/api06/changeset_upload_handler.hpp
@@ -33,7 +33,7 @@ class changeset_upload_handler : public payload_enabled_handler {
   responder_ptr_t responder(data_selection &x) const override;
 
   responder_ptr_t responder(data_update &,
-			    const std::string &payload,
+                            const std::string &payload,
                             std::optional<osm_user_id_t> user_id) const override;
   bool requires_selection_after_update() const override;
 
diff --git a/include/cgimap/api06/handler_utils.hpp b/include/cgimap/api06/handler_utils.hpp
index 96b80382..31c7d2e4 100644
--- a/include/cgimap/api06/handler_utils.hpp
+++ b/include/cgimap/api06/handler_utils.hpp
@@ -13,13 +13,13 @@
 #include "cgimap/types.hpp"
 #include "cgimap/request.hpp"
 #include "cgimap/api06/id_version.hpp"
+
 #include <vector>
 #include <string_view>
 
 namespace api06 {
 
-std::vector<id_version> parse_id_list_params(const request &req,
-                                             std::string_view param_name);
+std::vector<id_version> parse_id_list_params(const request &req, std::string_view param_name);
 }
 
 #endif /* API06_HANDLER_UTILS_HPP */
diff --git a/include/cgimap/api06/relations_handler.hpp b/include/cgimap/api06/relations_handler.hpp
index ccf20544..b8eae60e 100644
--- a/include/cgimap/api06/relations_handler.hpp
+++ b/include/cgimap/api06/relations_handler.hpp
@@ -16,8 +16,9 @@
 #include "cgimap/data_selection.hpp"
 #include "cgimap/request.hpp"
 #include "cgimap/api06/id_version.hpp"
+
 #include <string>
-#include <list>
+#include <vector>
 
 namespace api06 {
 
diff --git a/include/cgimap/api06/way_history_handler.hpp b/include/cgimap/api06/way_history_handler.hpp
index ae37ebaa..db788571 100644
--- a/include/cgimap/api06/way_history_handler.hpp
+++ b/include/cgimap/api06/way_history_handler.hpp
@@ -14,6 +14,8 @@
 #include "cgimap/osm_current_responder.hpp"
 #include "cgimap/request.hpp"
 
+#include <string>
+
 namespace api06 {
 
 class way_history_responder : public osm_current_responder {
diff --git a/include/cgimap/api06/way_relations_handler.hpp b/include/cgimap/api06/way_relations_handler.hpp
index 9d390b3e..d1f37d04 100644
--- a/include/cgimap/api06/way_relations_handler.hpp
+++ b/include/cgimap/api06/way_relations_handler.hpp
@@ -13,6 +13,7 @@
 #include "cgimap/handler.hpp"
 #include "cgimap/osm_current_responder.hpp"
 #include "cgimap/request.hpp"
+
 #include <string>
 
 namespace api06 {
diff --git a/include/cgimap/api06/way_version_handler.hpp b/include/cgimap/api06/way_version_handler.hpp
index d9053f05..7cdf1084 100644
--- a/include/cgimap/api06/way_version_handler.hpp
+++ b/include/cgimap/api06/way_version_handler.hpp
@@ -13,6 +13,7 @@
 #include "cgimap/handler.hpp"
 #include "cgimap/osm_current_responder.hpp"
 #include "cgimap/request.hpp"
+
 #include <string>
 
 namespace api06 {
diff --git a/include/cgimap/api06/ways_handler.hpp b/include/cgimap/api06/ways_handler.hpp
index 3bd19c52..152512a8 100644
--- a/include/cgimap/api06/ways_handler.hpp
+++ b/include/cgimap/api06/ways_handler.hpp
@@ -15,8 +15,9 @@
 #include "cgimap/request_helpers.hpp"
 #include "cgimap/request.hpp"
 #include "cgimap/api06/id_version.hpp"
+
 #include <string>
-#include <list>
+#include <vector>
 
 namespace api06 {
 
diff --git a/include/cgimap/data_selection.hpp b/include/cgimap/data_selection.hpp
index 4ff5a816..21972b5d 100644
--- a/include/cgimap/data_selection.hpp
+++ b/include/cgimap/data_selection.hpp
@@ -15,8 +15,8 @@
 
 #include <chrono>
 #include <memory>
-#include <sstream>
 #include <vector>
+#include <string>
 
 class Transaction_Owner_Base;
 
@@ -171,8 +171,10 @@ class data_selection {
   // is user currently blocked?
   virtual bool is_user_blocked(const osm_user_id_t) = 0;
 
-  virtual bool get_user_id_pass(const std::string& display_name, osm_user_id_t &,
-				std::string & pass_crypt, std::string & pass_salt) = 0;
+  virtual bool get_user_id_pass(const std::string& display_name, 
+                                osm_user_id_t &,
+                                std::string & pass_crypt, 
+                                std::string & pass_salt) = 0;
 
   // is user status confirmed or active?
   virtual bool is_user_active(const osm_user_id_t) = 0;
diff --git a/include/cgimap/data_update.hpp b/include/cgimap/data_update.hpp
index 45bbb6eb..71586598 100644
--- a/include/cgimap/data_update.hpp
+++ b/include/cgimap/data_update.hpp
@@ -26,10 +26,10 @@
 
 class data_update {
 public:
-  virtual ~data_update() = default;
-
   data_update() = default;
 
+  virtual ~data_update() = default;
+
   data_update(const data_update&) = delete;
   data_update& operator=(const data_update&) = delete;
 
diff --git a/include/cgimap/handler.hpp b/include/cgimap/handler.hpp
index e4a70389..d68ab022 100644
--- a/include/cgimap/handler.hpp
+++ b/include/cgimap/handler.hpp
@@ -22,6 +22,7 @@
 #include <set>
 #include <string>
 #include <memory>
+#include <optional>
 
 
 /**
@@ -63,6 +64,7 @@ class handler {
   handler(mime::type default_type = mime::unspecified_type,
           http::method methods = default_methods);
   virtual ~handler() = default;
+
   virtual std::string log_name() const = 0;
   virtual responder_ptr_t responder(data_selection &) const = 0;
 
@@ -89,10 +91,12 @@ using handler_ptr_t = std::unique_ptr<handler>;
 class payload_enabled_handler : public handler {
 public:
   payload_enabled_handler(mime::type default_type = mime::unspecified_type,
-    http::method methods = http::method::POST | http::method::OPTIONS);
+                          http::method methods = http::method::POST | http::method::OPTIONS);
 
   // Responder used to update the database
-  virtual responder_ptr_t responder(data_update &, const std::string & payload, std::optional<osm_user_id_t> user_id) const = 0;
+  virtual responder_ptr_t responder(data_update &, 
+                                    const std::string & payload, 
+                                    std::optional<osm_user_id_t> user_id) const = 0;
 
   // Optional responder to return XML response back to caller of the API method
   responder_ptr_t responder(data_selection &) const override = 0;
diff --git a/include/cgimap/logger.hpp b/include/cgimap/logger.hpp
index 7b1c3a4e..c678aa3d 100644
--- a/include/cgimap/logger.hpp
+++ b/include/cgimap/logger.hpp
@@ -10,7 +10,7 @@
 #ifndef LOGGER_HPP
 #define LOGGER_HPP
 
-#include <fmt/core.h>
+#include <string>
 
 /**
  * Contains support for logging.
diff --git a/include/cgimap/osm_current_responder.hpp b/include/cgimap/osm_current_responder.hpp
index 7e15f92d..0f1461fb 100644
--- a/include/cgimap/osm_current_responder.hpp
+++ b/include/cgimap/osm_current_responder.hpp
@@ -22,8 +22,9 @@ class osm_current_responder : public osm_responder {
 public:
   // construct, passing the mime type down to the responder.
   // optional bounds are stored at this level, but available to derived classes.
-  osm_current_responder(mime::type, data_selection &s,
-                        std::optional<bbox> bounds = std::optional<bbox>());
+  osm_current_responder(mime::type, 
+                        data_selection &s,
+                        std::optional<bbox> bounds = {});
 
   // writes whatever is in the tmp_nodes/ways/relations tables to the given
   // formatter.
diff --git a/include/cgimap/osm_responder.hpp b/include/cgimap/osm_responder.hpp
index 9a8a61c0..18ff63b2 100644
--- a/include/cgimap/osm_responder.hpp
+++ b/include/cgimap/osm_responder.hpp
@@ -30,8 +30,7 @@ class osm_responder : public responder {
 public:
   // construct, passing the mime type down to the responder.
   // optional bounds are stored at this level, but available to derived classes.
-  explicit osm_responder(mime::type,
-                std::optional<bbox> bounds = {});
+  explicit osm_responder(mime::type, std::optional<bbox> bounds = {});
 
   ~osm_responder() override = default;
 
diff --git a/include/cgimap/request_helpers.hpp b/include/cgimap/request_helpers.hpp
index b6664708..83e3c4cd 100644
--- a/include/cgimap/request_helpers.hpp
+++ b/include/cgimap/request_helpers.hpp
@@ -13,12 +13,14 @@
 #include <string>
 #include "cgimap/request.hpp"
 #include "cgimap/http.hpp"
+#include <memory>
 
 /**
  * Lookup a string from the request environment. Throws 500 error if the
  * string isn't there and no default value is given.
  */
-std::string fcgi_get_env(const request &req, const char *name,
+std::string fcgi_get_env(const request &req, 
+                         const char *name,
                          const char *default_value = nullptr);
 
 /**
diff --git a/src/api06/changeset_close_handler.cpp b/src/api06/changeset_close_handler.cpp
index b093b451..20f0a216 100644
--- a/src/api06/changeset_close_handler.cpp
+++ b/src/api06/changeset_close_handler.cpp
@@ -18,11 +18,19 @@
 #include "cgimap/types.hpp"
 #include "cgimap/util.hpp"
 
+#include <fmt/core.h>
+
+#include <string>
+#include <memory>
+#include <optional>
+
 namespace api06 {
 
-changeset_close_responder::changeset_close_responder(
-    mime::type mt, data_update & upd, osm_changeset_id_t changeset, const std::string &,
-    std::optional<osm_user_id_t> user_id)
+changeset_close_responder::changeset_close_responder(mime::type mt, 
+                                                     data_update & upd, 
+                                                     osm_changeset_id_t changeset, 
+                                                     const std::string &, 
+                                                     std::optional<osm_user_id_t> user_id)
     : text_responder(mt) {
 
   auto changeset_updater = upd.get_changeset_updater(changeset, *user_id);
@@ -32,7 +40,7 @@ changeset_close_responder::changeset_close_responder(
 
 
 changeset_close_handler::changeset_close_handler(const request &,
-                                                   osm_changeset_id_t id)
+                                                 osm_changeset_id_t id)
     : payload_enabled_handler(mime::text_plain,
                               http::method::PUT | http::method::OPTIONS),
       id(id) {}
@@ -42,14 +50,13 @@ std::string changeset_close_handler::log_name() const {
   return (fmt::format("changeset/close {:d}", id));
 }
 
-responder_ptr_t
-changeset_close_handler::responder(data_selection &) const {
-  throw http::server_error(
-      "changeset_close_handler: data_selection unsupported");
+responder_ptr_t changeset_close_handler::responder(data_selection &) const {
+  throw http::server_error("changeset_close_handler: data_selection unsupported");
 }
 
-responder_ptr_t changeset_close_handler::responder(
-    data_update & upd, const std::string &payload, std::optional<osm_user_id_t> user_id) const {
+responder_ptr_t changeset_close_handler::responder(data_update & upd, 
+                                                   const std::string &payload, 
+                                                   std::optional<osm_user_id_t> user_id) const {
   return std::make_unique<changeset_close_responder>(mime_type, upd, id, payload, user_id);
 }
 
diff --git a/src/api06/changeset_create_handler.cpp b/src/api06/changeset_create_handler.cpp
index d27d881b..a4a52359 100644
--- a/src/api06/changeset_create_handler.cpp
+++ b/src/api06/changeset_create_handler.cpp
@@ -21,11 +21,15 @@
 #include "cgimap/types.hpp"
 #include "cgimap/util.hpp"
 
+#include <string>
+#include <optional>
+
 namespace api06 {
 
-changeset_create_responder::changeset_create_responder(
-    mime::type mt, data_update & upd, const std::string &payload,
-    std::optional<osm_user_id_t> user_id)
+changeset_create_responder::changeset_create_responder(mime::type mt, 
+                                                       data_update & upd, 
+                                                       const std::string &payload,
+                                                       std::optional<osm_user_id_t> user_id)
     : text_responder(mt) {
 
   osm_changeset_id_t changeset = 0;
@@ -48,12 +52,12 @@ std::string changeset_create_handler::log_name() const {
 
 responder_ptr_t
 changeset_create_handler::responder(data_selection &) const {
-  throw http::server_error(
-      "changeset_create_handler: data_selection unsupported");
+  throw http::server_error("changeset_create_handler: data_selection unsupported");
 }
 
-responder_ptr_t changeset_create_handler::responder(
-    data_update & upd, const std::string &payload, std::optional<osm_user_id_t> user_id) const {
+responder_ptr_t changeset_create_handler::responder(data_update & upd, 
+                                                    const std::string &payload, 
+                                                    std::optional<osm_user_id_t> user_id) const {
   return std::make_unique<changeset_create_responder>(mime_type, upd, payload, user_id);
 }
 
diff --git a/src/api06/changeset_download_handler.cpp b/src/api06/changeset_download_handler.cpp
index 1d1f796a..a6312e23 100644
--- a/src/api06/changeset_download_handler.cpp
+++ b/src/api06/changeset_download_handler.cpp
@@ -16,8 +16,9 @@
 
 namespace api06 {
 
-changeset_download_responder::changeset_download_responder(
-  mime::type mt, osm_changeset_id_t id, data_selection &w)
+changeset_download_responder::changeset_download_responder(mime::type mt, 
+                                                           osm_changeset_id_t id, 
+                                                           data_selection &w)
   : osmchange_responder(mt, w) {
 
   if (sel.select_changesets({id}) == 0) {
diff --git a/src/api06/changeset_handler.cpp b/src/api06/changeset_handler.cpp
index fe450ec4..e297f4e2 100644
--- a/src/api06/changeset_handler.cpp
+++ b/src/api06/changeset_handler.cpp
@@ -18,7 +18,8 @@ using std::vector;
 
 namespace api06 {
 
-changeset_responder::changeset_responder(mime::type mt, osm_changeset_id_t id,
+changeset_responder::changeset_responder(mime::type mt, 
+                                         osm_changeset_id_t id,
                                          bool include_discussion,
                                          data_selection &w)
   : osm_current_responder(mt, w) {
diff --git a/src/api06/changeset_update_handler.cpp b/src/api06/changeset_update_handler.cpp
index 0a27a081..967c13c9 100644
--- a/src/api06/changeset_update_handler.cpp
+++ b/src/api06/changeset_update_handler.cpp
@@ -21,6 +21,8 @@
 #include "cgimap/util.hpp"
 
 
+#include <fmt/core.h>
+
 
 namespace api06 {
 
@@ -66,8 +68,9 @@ changeset_update_handler::responder(data_selection &sel) const {
   return std::make_unique<changeset_update_sel_responder>(mime_type, sel, id);
 }
 
-responder_ptr_t changeset_update_handler::responder(
-    data_update & upd, const std::string &payload, std::optional<osm_user_id_t> user_id) const {
+responder_ptr_t changeset_update_handler::responder(data_update & upd, 
+                                                    const std::string &payload, 
+                                                    std::optional<osm_user_id_t> user_id) const {
   return std::make_unique<changeset_update_responder>(mime_type, upd, id, payload, user_id);
 }
 
diff --git a/src/api06/changeset_upload/osmchange_handler.cpp b/src/api06/changeset_upload/osmchange_handler.cpp
index f008739f..148927b4 100644
--- a/src/api06/changeset_upload/osmchange_handler.cpp
+++ b/src/api06/changeset_upload/osmchange_handler.cpp
@@ -7,26 +7,22 @@
  * For a full list of authors see the git log.
  */
 
+#include "cgimap/api06/changeset_upload/osmchange_handler.hpp"
 
 #include "cgimap/http.hpp"
-#include "cgimap/logger.hpp"
-
-#include "cgimap/api06/changeset_upload/osmchange_handler.hpp"
 
 #include <fmt/core.h>
 
 namespace api06 {
 
-OSMChange_Handler::OSMChange_Handler(
-    Node_Updater& node_updater,
-    Way_Updater& way_updater,
-    Relation_Updater& relation_updater,
-    osm_changeset_id_t changeset)
+OSMChange_Handler::OSMChange_Handler(Node_Updater& node_updater,
+                                     Way_Updater& way_updater,
+                                     Relation_Updater& relation_updater,
+                                     osm_changeset_id_t changeset)
     : node_updater(node_updater),
       way_updater(way_updater),
       relation_updater(relation_updater),
       changeset(changeset)
-
 {}
 
 void OSMChange_Handler::start_document() {}
@@ -43,7 +39,8 @@ void OSMChange_Handler::check_osm_object(const OSMObject &o) const {
          o.changeset(), changeset));
 }
 
-void OSMChange_Handler::process_node(const Node &node, operation op,
+void OSMChange_Handler::process_node(const Node &node, 
+                                     operation op,
                                      bool if_unused) {
 
   assert(op != operation::op_undefined);
@@ -105,7 +102,8 @@ void OSMChange_Handler::process_way(const Way &way, operation op,
   }
 }
 
-void OSMChange_Handler::process_relation(const Relation &relation, operation op,
+void OSMChange_Handler::process_relation(const Relation &relation, 
+                                         operation op,
                                          bool if_unused) {
 
   assert(op != operation::op_undefined);
@@ -142,7 +140,8 @@ void OSMChange_Handler::finish_processing() {
 }
 
 uint32_t OSMChange_Handler::get_num_changes() const {
-  return (node_updater.get_num_changes() + way_updater.get_num_changes() +
+  return (node_updater.get_num_changes() + 
+          way_updater.get_num_changes() +
           relation_updater.get_num_changes());
 }
 
diff --git a/src/api06/changeset_upload/osmchange_tracking.cpp b/src/api06/changeset_upload/osmchange_tracking.cpp
index cfce8d22..90c09950 100644
--- a/src/api06/changeset_upload/osmchange_tracking.cpp
+++ b/src/api06/changeset_upload/osmchange_tracking.cpp
@@ -12,6 +12,8 @@
 
 #include <fmt/core.h>
 
+#include <set>
+
 namespace api06 {
 
   std::vector<diffresult_t> OSMChange_Tracking::assemble_diffresult() {
diff --git a/src/api06/changeset_upload_handler.cpp b/src/api06/changeset_upload_handler.cpp
index 15b89804..33cdc879 100644
--- a/src/api06/changeset_upload_handler.cpp
+++ b/src/api06/changeset_upload_handler.cpp
@@ -25,12 +25,15 @@
 #include "cgimap/types.hpp"
 #include "cgimap/util.hpp"
 
+#include <string>
 
 namespace api06 {
 
-changeset_upload_responder::changeset_upload_responder(
-    mime::type mt, data_update& upd, osm_changeset_id_t changeset, const std::string &payload,
-    std::optional<osm_user_id_t> user_id)
+changeset_upload_responder::changeset_upload_responder(mime::type mt, 
+                                                       data_update& upd, 
+                                                       osm_changeset_id_t changeset, 
+                                                       const std::string &payload,
+                                                       std::optional<osm_user_id_t> user_id)
     : osm_diffresult_responder(mt) {
 
   OSMChange_Tracking change_tracking{};
@@ -81,14 +84,14 @@ std::string changeset_upload_handler::log_name() const {
   return (fmt::format("changeset/upload {:d}", id));
 }
 
-responder_ptr_t
-changeset_upload_handler::responder(data_selection &) const {
+responder_ptr_t changeset_upload_handler::responder(data_selection &) const {
   throw http::server_error(
       "changeset_upload_handler: data_selection unsupported");
 }
 
-responder_ptr_t changeset_upload_handler::responder(
-    data_update & upd, const std::string &payload, std::optional<osm_user_id_t> user_id) const {
+responder_ptr_t changeset_upload_handler::responder(data_update & upd, 
+                                                    const std::string &payload, 
+                                                    std::optional<osm_user_id_t> user_id) const {
   return std::make_unique<changeset_upload_responder>(mime_type, upd, id, payload, user_id);
 }
 
diff --git a/src/api06/node_relations_handler.cpp b/src/api06/node_relations_handler.cpp
index 22988991..cb7aa394 100644
--- a/src/api06/node_relations_handler.cpp
+++ b/src/api06/node_relations_handler.cpp
@@ -12,8 +12,9 @@
 
 namespace api06 {
 
-node_relations_responder::node_relations_responder(mime::type mt, osm_nwr_id_t id,
-                                         data_selection &w)
+node_relations_responder::node_relations_responder(mime::type mt, 
+                                                   osm_nwr_id_t id,
+                                                   data_selection &w)
     : osm_current_responder(mt, w) {
 
   if (sel.select_nodes({id}) > 0 && is_visible(id)) {
diff --git a/src/api06/node_version_handler.cpp b/src/api06/node_version_handler.cpp
index 701c3ee3..7d984c18 100644
--- a/src/api06/node_version_handler.cpp
+++ b/src/api06/node_version_handler.cpp
@@ -12,7 +12,10 @@
 
 namespace api06 {
 
-node_version_responder::node_version_responder(mime::type mt, osm_nwr_id_t id, osm_version_t v, data_selection &w)
+node_version_responder::node_version_responder(mime::type mt, 
+                                               osm_nwr_id_t id, 
+                                               osm_version_t v, 
+                                               data_selection &w)
     : osm_current_responder(mt, w) {
 
   if (sel.select_historical_nodes({std::make_pair(id, v)}) == 0) {
@@ -20,7 +23,8 @@ node_version_responder::node_version_responder(mime::type mt, osm_nwr_id_t id, o
   }
 }
 
-node_version_handler::node_version_handler(const request &, osm_nwr_id_t id, osm_version_t v) : id(id), v(v) {}
+node_version_handler::node_version_handler(const request &, osm_nwr_id_t id, osm_version_t v) : 
+  id(id), v(v) {}
 
 std::string node_version_handler::log_name() const { return "node"; }
 
diff --git a/src/api06/node_ways_handler.cpp b/src/api06/node_ways_handler.cpp
index 1f6a4526..91cfd0ad 100644
--- a/src/api06/node_ways_handler.cpp
+++ b/src/api06/node_ways_handler.cpp
@@ -12,7 +12,8 @@
 
 namespace api06 {
 
-node_ways_responder::node_ways_responder(mime::type mt, osm_nwr_id_t id,
+node_ways_responder::node_ways_responder(mime::type mt, 
+                                         osm_nwr_id_t id,
                                          data_selection &w)
     : osm_current_responder(mt, w) {
 
diff --git a/src/api06/relation_handler.cpp b/src/api06/relation_handler.cpp
index 94989792..c2a9298d 100644
--- a/src/api06/relation_handler.cpp
+++ b/src/api06/relation_handler.cpp
@@ -10,6 +10,8 @@
 #include "cgimap/api06/relation_handler.hpp"
 #include "cgimap/http.hpp"
 
+#include <fmt/core.h>
+
 namespace api06 {
 
 relation_responder::relation_responder(mime::type mt, osm_nwr_id_t id,
diff --git a/src/api06/relation_relations_handler.cpp b/src/api06/relation_relations_handler.cpp
index ba3466f3..bd79fa23 100644
--- a/src/api06/relation_relations_handler.cpp
+++ b/src/api06/relation_relations_handler.cpp
@@ -12,8 +12,9 @@
 
 namespace api06 {
 
-relation_relations_responder::relation_relations_responder(mime::type mt, osm_nwr_id_t id,
-                                         data_selection &w)
+relation_relations_responder::relation_relations_responder(mime::type mt, 
+                                                           osm_nwr_id_t id,
+                                                           data_selection &w)
     : osm_current_responder(mt, w) {
 
   if (sel.select_relations({id}) > 0 && is_visible(id)) {
diff --git a/src/api06/relations_handler.cpp b/src/api06/relations_handler.cpp
index d6ae9e6d..339e5234 100644
--- a/src/api06/relations_handler.cpp
+++ b/src/api06/relations_handler.cpp
@@ -15,6 +15,10 @@
 #include <fmt/core.h>
 #include <fmt/format.h>
 
+#include <sstream>
+#include <string>
+#include <vector>
+
 using std::vector;
 using std::string;
 
diff --git a/src/api06/way_full_handler.cpp b/src/api06/way_full_handler.cpp
index dd510a73..19b25a1e 100644
--- a/src/api06/way_full_handler.cpp
+++ b/src/api06/way_full_handler.cpp
@@ -10,13 +10,13 @@
 #include "cgimap/api06/way_full_handler.hpp"
 #include "cgimap/http.hpp"
 #include "cgimap/logger.hpp"
-#include <fmt/core.h>
 
-using std::vector;
+#include <fmt/core.h>
 
 namespace api06 {
 
-way_full_responder::way_full_responder(mime::type mt, osm_nwr_id_t id,
+way_full_responder::way_full_responder(mime::type mt, 
+                                       osm_nwr_id_t id,
                                        data_selection &w)
     : osm_current_responder(mt, w) {
 
@@ -43,8 +43,7 @@ void way_full_responder::check_visibility(osm_nwr_id_t id) {
 }
 
 way_full_handler::way_full_handler(const request &, osm_nwr_id_t id) : id(id) {
-  logger::message(
-      fmt::format("starting way/full handler with id = {:d}", id));
+  logger::message(fmt::format("starting way/full handler with id = {:d}", id));
 }
 
 std::string way_full_handler::log_name() const { return "way/full"; }
diff --git a/src/api06/way_handler.cpp b/src/api06/way_handler.cpp
index da69790e..7c6e46fc 100644
--- a/src/api06/way_handler.cpp
+++ b/src/api06/way_handler.cpp
@@ -10,6 +10,9 @@
 #include "cgimap/api06/way_handler.hpp"
 #include "cgimap/http.hpp"
 
+#include <string>
+#include <memory>
+
 #include <fmt/core.h>
 
 namespace api06 {
diff --git a/src/api06/way_history_handler.cpp b/src/api06/way_history_handler.cpp
index f3a3281f..3e109c09 100644
--- a/src/api06/way_history_handler.cpp
+++ b/src/api06/way_history_handler.cpp
@@ -10,6 +10,9 @@
 #include "cgimap/api06/way_history_handler.hpp"
 #include "cgimap/http.hpp"
 
+#include <string>
+#include <memory>
+
 namespace api06 {
 
 way_history_responder::way_history_responder(mime::type mt, osm_nwr_id_t id, data_selection &w)
diff --git a/src/api06/way_relations_handler.cpp b/src/api06/way_relations_handler.cpp
index 1310611c..692154ad 100644
--- a/src/api06/way_relations_handler.cpp
+++ b/src/api06/way_relations_handler.cpp
@@ -10,10 +10,14 @@
 #include "cgimap/api06/way_relations_handler.hpp"
 #include "cgimap/http.hpp"
 
+#include <string>
+#include <memory>
+
 namespace api06 {
 
-way_relations_responder::way_relations_responder(mime::type mt, osm_nwr_id_t id,
-                                         data_selection &w)
+way_relations_responder::way_relations_responder(mime::type mt, 
+                                                 osm_nwr_id_t id,
+                                                 data_selection &w)
     : osm_current_responder(mt, w) {
 
   if (sel.select_ways({id}) > 0 && is_visible(id)) {
diff --git a/src/api06/way_version_handler.cpp b/src/api06/way_version_handler.cpp
index 1698c52b..41043244 100644
--- a/src/api06/way_version_handler.cpp
+++ b/src/api06/way_version_handler.cpp
@@ -10,9 +10,14 @@
 #include "cgimap/api06/way_version_handler.hpp"
 #include "cgimap/http.hpp"
 
+#include <string>
+
 namespace api06 {
 
-way_version_responder::way_version_responder(mime::type mt, osm_nwr_id_t id, osm_version_t v, data_selection &w)
+way_version_responder::way_version_responder(mime::type mt, 
+                                             osm_nwr_id_t id, 
+                                             osm_version_t v, 
+                                             data_selection &w)
     : osm_current_responder(mt, w) {
 
   if (sel.select_historical_ways({std::make_pair(id, v)}) == 0) {
@@ -20,7 +25,8 @@ way_version_responder::way_version_responder(mime::type mt, osm_nwr_id_t id, osm
   }
 }
 
-way_version_handler::way_version_handler(const request &, osm_nwr_id_t id, osm_version_t v) : id(id), v(v) {}
+way_version_handler::way_version_handler(const request &, osm_nwr_id_t id, osm_version_t v) : 
+  id(id), v(v) {}
 
 std::string way_version_handler::log_name() const { return "way"; }
 
diff --git a/src/api07/map_handler.cpp b/src/api07/map_handler.cpp
index 2cb1ffcd..7d6b0bdf 100644
--- a/src/api07/map_handler.cpp
+++ b/src/api07/map_handler.cpp
@@ -12,7 +12,9 @@
 #include "cgimap/request_helpers.hpp"
 #include "cgimap/logger.hpp"
 #include "cgimap/options.hpp"
+
 #include <fmt/core.h>
+
 #include <map>
 
 
diff --git a/src/backend/apidb/pgsql_update.cpp b/src/backend/apidb/pgsql_update.cpp
index af57f470..9a981c7d 100644
--- a/src/backend/apidb/pgsql_update.cpp
+++ b/src/backend/apidb/pgsql_update.cpp
@@ -9,8 +9,6 @@
 
 #include "cgimap/backend/apidb/pgsql_update.hpp"
 #include "cgimap/backend/apidb/apidb.hpp"
-#include "cgimap/logger.hpp"
-
 #include "cgimap/backend/apidb/pqxx_string_traits.hpp"
 #include "cgimap/backend/apidb/utils.hpp"
 #include "cgimap/backend/apidb/transaction_manager.hpp"
@@ -21,17 +19,10 @@
 #include "cgimap/backend/apidb/changeset_upload/way_updater.hpp"
 
 #include <functional>
-#include <set>
 #include <sstream>
-#include <list>
-#include <vector>
-#include <boost/iterator/transform_iterator.hpp>
 
 
 namespace po = boost::program_options;
-using std::set;
-using std::list;
-using std::vector;
 
 namespace {
 std::string connect_db_str(const po::variables_map &options) {
@@ -64,9 +55,9 @@ std::string connect_db_str(const po::variables_map &options) {
 
 } // anonymous namespace
 
-pgsql_update::pgsql_update(
-    Transaction_Owner_Base& to, bool readonly)
-    : m{ to }, m_readonly{ readonly } {
+pgsql_update::pgsql_update(Transaction_Owner_Base& to, bool readonly)
+    : m{ to }, 
+      m_readonly{ readonly } {
 
   if (is_api_write_disabled())
     return;
diff --git a/src/basicauth.cpp b/src/basicauth.cpp
index a02dc2bb..29f2aa74 100644
--- a/src/basicauth.cpp
+++ b/src/basicauth.cpp
@@ -25,7 +25,6 @@
 
 #include <boost/algorithm/string.hpp>
 
-
 #include "cgimap/basicauth.hpp"
 #include "cgimap/options.hpp"
 
@@ -33,8 +32,8 @@
 using namespace CryptoPP;
 
 bool PasswordHash::check(const std::string& pass_crypt,
-			 const std::string& pass_salt,
-			 const std::string& candidate) {
+                         const std::string& pass_salt,
+                         const std::string& candidate) {
 
   std::string hashed_candidate;
 
diff --git a/src/fcgi_request.cpp b/src/fcgi_request.cpp
index b710d6b5..37223ae3 100644
--- a/src/fcgi_request.cpp
+++ b/src/fcgi_request.cpp
@@ -14,6 +14,8 @@
 #include "cgimap/output_buffer.hpp"
 #include "cgimap/request_helpers.hpp"
 
+#include <fmt/core.h>
+
 #include <array>
 #include <iostream>
 #include <stdexcept>
diff --git a/src/logger.cpp b/src/logger.cpp
index 8351b2a9..d4e5eeee 100644
--- a/src/logger.cpp
+++ b/src/logger.cpp
@@ -16,25 +16,18 @@
 #include <memory>
 
 #include "cgimap/logger.hpp"
-#include <fmt/core.h>
-
-using std::string;
-using std::ostream;
-using std::ofstream;
-
-
 
 namespace logger {
 
-static std::unique_ptr<ostream> stream;
+static std::unique_ptr<std::ostream> stream;
 static pid_t pid;
 
-void initialise(const string &filename) {
-  stream = std::make_unique<ofstream>(filename.c_str(), std::ios_base::out | std::ios_base::app);
+void initialise(const std::string &filename) {
+  stream = std::make_unique<std::ofstream>(filename.c_str(), std::ios_base::out | std::ios_base::app);
   pid = getpid();
 }
 
-void message(const string &m) {
+void message(const std::string &m) {
   if (stream) {
     time_t now = time(0);
     *stream << "[" << std::put_time( std::gmtime( &now ), "%FT%T") << " #" << pid << "] " << m
diff --git a/src/main.cpp b/src/main.cpp
index 288f5f85..a5d8de27 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -58,7 +58,6 @@ using std::map;
 using std::ostringstream;
 
 
-namespace al = boost::algorithm;
 namespace po = boost::program_options;
 
 /**
diff --git a/src/osm_current_responder.cpp b/src/osm_current_responder.cpp
index d44091b6..df5a6b08 100644
--- a/src/osm_current_responder.cpp
+++ b/src/osm_current_responder.cpp
@@ -13,11 +13,15 @@
 
 #include <fmt/core.h>
 
+#include <optional>
+
 using std::list;
 
-osm_current_responder::osm_current_responder(mime::type mt, data_selection &s,
+osm_current_responder::osm_current_responder(mime::type mt, 
+                                             data_selection &s,
                                              std::optional<bbox> b)
-    : osm_responder(mt, b), sel(s) {}
+    : osm_responder(mt, b), 
+      sel(s) {}
 
 
 void osm_current_responder::write(output_formatter& fmt,
diff --git a/src/osmchange_responder.cpp b/src/osmchange_responder.cpp
index d5762d72..88103e0c 100644
--- a/src/osmchange_responder.cpp
+++ b/src/osmchange_responder.cpp
@@ -226,7 +226,6 @@ osmchange_responder::osmchange_responder(mime::type mt, data_selection &s)
     sel(s) {
 }
 
-
 std::vector<mime::type> osmchange_responder::types_available() const {
   std::vector<mime::type> types; // TODO: don't reconstruct on every call
   types.push_back(mime::application_xml);
diff --git a/src/request_helpers.cpp b/src/request_helpers.cpp
index c1dfbd70..9232aa35 100644
--- a/src/request_helpers.cpp
+++ b/src/request_helpers.cpp
@@ -9,9 +9,11 @@
 
 #include "cgimap/request_helpers.hpp"
 #include "cgimap/zlib.hpp"
+
 #include <sstream>
 #include <cassert>
 #include <cstring>
+
 #include <fmt/core.h>
 
 using std::string;
diff --git a/src/routes.cpp b/src/routes.cpp
index de889407..9df05d9c 100644
--- a/src/routes.cpp
+++ b/src/routes.cpp
@@ -56,6 +56,7 @@
 #include <optional>
 
 #include <boost/algorithm/string.hpp>
+#include <fmt/core.h>
 
 using std::list;
 using std::string;
@@ -76,21 +77,24 @@ struct router {
   // interface through which all matches and constructions are performed.
   struct rule_base {
     virtual ~rule_base() = default;
-    virtual bool invoke_if(const list<string> &, request &,
-                           handler_ptr_t &) = 0;
+    virtual bool invoke_if(const list<string> &, request &, handler_ptr_t &) = 0;
   };
 
   using rule_ptr = std::unique_ptr<rule_base>;
 
   // concrete rule match / constructor class
-  template <typename rule_t, typename func_t> struct rule : public rule_base {
+  template <typename rule_t, typename func_t> 
+  struct rule : public rule_base {
     // the DSL rule expression to match
     rule_t r;
 
     // the function to call (used later as constructor factory)
     func_t func;
 
-    rule(rule_t r_, func_t f_) : r(std::move(r_)), func(f_) {}
+    rule(rule_t r_, func_t f_) : 
+      r(std::move(r_)), 
+      func(f_) 
+    {}
 
     // try to match the expression. if it succeeds, call the provided function
     // with the provided params and the matched DSL arguments.