diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index ed1f7b4b499202c165c5a170c87215f0ec3ceb36..adc3f07b5248e7a5fd9d33193a35c073f34e0830 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -62,14 +62,14 @@ code_style_octave:
   stage: test
   script:
     - mh_style -v
-    - mh_style --octave ./src ./doc
+    - make style_octave
   allow_failure: true
 
 code_style_cpp:
   tags: [ docker ]
   stage: test
   script:
-    - make style
+    - make style_cpp
   allow_failure: true
 
 unit_tests:
@@ -91,7 +91,7 @@ linting_octave:
   tags: [ docker ]
   stage: test
   script:
-    - mh_lint --octave ./
+    - make linting_octave
   allow_failure: true
 
 # linting with clang-tidy and include-what-you-use
@@ -99,11 +99,7 @@ linting_cpp:
   tags: [ docker ]
   stage: test
   script:
-    - cd src
-    - ./configure
-    - cd ../build
-    - cmake -D LINTING=On ..
-    - cmake --build .
+    - make linting_cpp
   allow_failure: true
 
 # trigger the integration tests
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fb790a60a97a7037c0614e6918a4a7ee4563ff9e..de06696a4e01024992c5ffa8371e7bcef0060aa8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -47,8 +47,9 @@ string(REGEX REPLACE ";grpc\\+?\\+?_unsecure" "" CONAN_PKG_LIBS
 #######################################################
 option(AUTOFORMATTING "call clang-format at configure time" ON)
 if(AUTOFORMATTING)
-    file(GLOB format_sources src/*.cpp)
-    execute_process(COMMAND clang-format -i --verbose ${format_sources}
+    find_program(clang_format NAMES clang-format-11 clang-format)
+    file(GLOB_RECURSE format_sources src/*.cpp)
+    execute_process(COMMAND ${clang_format} -i --verbose ${format_sources}
         WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
 endif()
 
@@ -77,7 +78,10 @@ get_property(_MAOX_LIB_DIR TARGET maoxdb PROPERTY LIBRARY_OUTPUT_DIRECTORY)
 # Only files in src/private will be compiled.  This is to separate the non-mex files in src/lib; if
 # this is to change, the GLOB_RECURSE code needs to be changed.
 
-add_subdirectory(src)
+# Absolute paths to the cpp files.
+file(GLOB_RECURSE OCTAVE_CAOSDB_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/private/*.cpp)
+message("OCTAVE_CAOSDB_SRC: ${OCTAVE_CAOSDB_SRC}")
+
 set(PKG_INST_DIR "${PROJECT_SOURCE_DIR}/inst")
 file(MAKE_DIRECTORY ${PKG_INST_DIR})
 
@@ -113,20 +117,19 @@ endforeach(sourcefile)
 #######################################################
 option(LINTING "clang-tidy and iwyu" OFF)
 if(LINTING)
-    find_program(clang_tidy NAMES clang-tidy clang-tidy-11)
+    find_program(clang_tidy NAMES clang-tidy-11 clang-tidy)
     if(NOT clang_tidy)
         message(WARNING "clang-tidy: Not found")
     else()
         message(STATUS "clang-tidy: ${clang_tidy}")
         set(_CMAKE_CXX_CLANG_TIDY
             "--warnings-as-errors=*"
-            "--header-filter=caosdb/.*[^\\\(\.pb\.h\\\)]$"
             "--fix")
         set(_CMAKE_CXX_CLANG_TIDY_CHECKS
           "--checks=*,-fuchsia-*,-llvmlibc-*,-llvm-else-after-return,-readability-else-after-return,-cppcoreguidelines-pro-type-vararg,-hicpp-vararg,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cert-err58-cpp")
 
         add_custom_command(
-            TARGET caosdb.mex
+            TARGET mex
             COMMAND ${clang_tidy}
             ARGS ${_CMAKE_CXX_CLANG_TIDY} ${_CMAKE_CXX_CLANG_TIDY_CHECKS}
             ${OCTAVE_CAOSDB_SRC} "--" ${_MKOCTFILE_INCLUDES} "-I/usr/include"
@@ -146,7 +149,7 @@ if(LINTING)
             "-Xiwyu" "--cxx17ns")
 
         add_custom_command(
-            TARGET caosdb.mex
+            TARGET mex
             COMMAND ${iwyu}
             ARGS ${_CMAKE_CXX_INCLUDE_WHAT_YOU_USE} "-I${OCTINCLUDEDIR}"
             "-std=c++17" "-I/usr/include" ${_MKOCTFILE_INCLUDES}
diff --git a/Makefile b/Makefile
index 0fe4b3ee03ae431914366609b3e9ab48c198c9af..72a48742c11b29f6003784def0861af19ad01243 100644
--- a/Makefile
+++ b/Makefile
@@ -33,16 +33,49 @@ help:
 doc:
 	cd doc && $(MAKE) html
 
-style:
-	mh_style --octave src doc test
-	clang-format-11 --dry-run --verbose --Werror $(shell find test/ src/ -type f -iname "*.cpp" -o -iname "*.hpp" -o -iname "*.h" -o -iname "*.h.in")
+###############################################################################
+#                                   Styling                                   #
+###############################################################################
+
+style: style_octave style_cpp
 .PHONY: style
 
+style_octave:
+	mh_style --octave src doc test || echo "You may want to run `make style_fix`."
+.PHONY: style_octave
+
+style_cpp:
+	clang-format-11 --dry-run --verbose --Werror $(shell find test/ src/ -type f -iname "*.cpp" -o -iname "*.hpp" -o -iname "*.h" -o -iname "*.h.in") || echo "You may want to run `make style_fix`."
+.PHONY: style_cpp
+
 style_fix:
 	mh_style --fix --octave src doc test
 	clang-format-11 -i --verbose --Werror $(shell find test/ src/ -type f -iname "*.cpp" -o -iname "*.hpp" -o -iname "*.h" -o -iname "*.h.in")
 .PHONY: style_fix
 
+###############################################################################
+#                                   Linting                                   #
+###############################################################################
+
+linting: linting_octave linting_cpp
+.PHONY: linting
+
+linting_octave:
+	mh_lint --octave ./
+.PHONY: linting_octave
+
+linting_cpp:
+	cd src                      \
+    && ./configure            \
+    && cd ../build            \
+    && cmake -D LINTING=On .. \
+    && cmake --build .
+.PHONY: linting_cpp
+
+###############################################################################
+#                                    Tests                                    #
+###############################################################################
+
 .PHONY: test
 test:
 	cd test && octave Run_Test.m
@@ -56,7 +89,7 @@ pkg: dist/caosdb.tar.gz
 
 .PHONY: install
 install: pkg
-	octave --eval "pkg -verbose install dist/caosdb.tar.gz"
+	octave --eval "pkg install -verbose dist/caosdb.tar.gz"
 
 .PHONY: caosdb.tar.gz
 dist/caosdb.tar.gz: dist/
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
deleted file mode 100644
index b8bdb6fd379c676a6c68bf434b2368d9a986edf6..0000000000000000000000000000000000000000
--- a/src/CMakeLists.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# This file is a part of the CaosDB Project.
-#
-# Copyright (C) 2021 Timm Fitschen <t.fitschen@indiscale.com>
-# Copyright (C) 2021 IndiScale GmbH <info@indiscale.com>
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see <https://www.gnu.org/licenses/>.
-#
-
-# We want to compile all the _*.cpp files in `private`
-set(OCTAVE_CAOSDB_SRC
-    ${CMAKE_CURRENT_SOURCE_DIR}/private/_caosdb.cpp
-    )
-
-# pass variable to parent scope
-set(OCTAVE_CAOSDB_SRC ${OCTAVE_CAOSDB_SRC} PARENT_SCOPE)
diff --git a/src/lib/maoxdb.hpp b/src/lib/maoxdb.hpp
index 6d443fa857d140485c2e81d9dd272eac0fa9271d..044313e22d507a7aa84e621a7bb7018029f37355 100644
--- a/src/lib/maoxdb.hpp
+++ b/src/lib/maoxdb.hpp
@@ -1,4 +1,4 @@
-#ifndef MAOXDB_H
+#ifndef MAOXDB_H                // NOLINT
 #define MAOXDB_H
 
 #include "caosdb/exceptions.h"
@@ -9,28 +9,6 @@
 
 // Macros /////////////////////////////////////////////////////////////////////
 
-/**
- * mxSCALAR(type, name, value): Create a 1x1 mxArray of type TYPE and value
- * VALUE.  The NAME must be unique within each scope.
- *
- * Use it like so (note that the assignment to NAME is necessary):
- *
- * auto* scalar = mxSCALAR(UINT64, scalar, value);
- *
- * This will exand to:
- *
- * mxCreateNumericMatrix(1, 1, mxUINT64_CLASS, mxREAL);
- * UINT64_T* scalar_data = (UINT64_T*) mxGetData(scalar);
- * scalar_data[0] = value;
- * mxSetData(scalar, scalar_data);
- *
- * TODO: This macro could be rewritten as a function now.
- */
-#define mxSCALAR(type, name, value)                                            \
-  mxCreateNumericMatrix(1, 1, mx##type##_CLASS, mxREAL);                       \
-  auto *__##name##_data = (type##_T *)mxGetData(name);                         \
-  __##name##_data[0] = value;                                                  \
-  mxSetData(name, __##name##_data)
 
 // Utility functions //////////////////////////////////////////////////////////
 namespace maoxdb {
@@ -39,7 +17,7 @@ using std::string;
 
 template <typename T> auto mxScalar(T value, mxClassID class_id) -> mxArray * {
   mxArray *array = mxCreateNumericMatrix(1, 1, class_id, mxREAL);
-  auto *data = (T *)mxGetData(array);
+  auto *data = static_cast<T *>(mxGetData(array));
   data[0] = value;
   return array;
 }
@@ -56,7 +34,7 @@ inline auto mxScalarDOUBLE(double value) -> mxArray * {
   return mxScalar<double>(value, mxDOUBLE_CLASS);
 }
 inline auto mxScalarLOGICAL(bool value) -> mxArray * {
-  return mxScalar<UINT8_T>(value, mxLOGICAL_CLASS);
+  return mxScalar<UINT8_T>(static_cast<unsigned char>(value), mxLOGICAL_CLASS);
 }
 
 /**
@@ -74,8 +52,8 @@ inline auto mxScalarLOGICAL(bool value) -> mxArray * {
  * @note Additional utility functions should be easy to implement when the
  * libcaosdb error handling changes.
  */
-std::pair<string, string>
-exceptionToMessage(const caosdb::exceptions::Exception &exc);
+auto
+exceptionToMessage(const caosdb::exceptions::Exception &exc) -> std::pair<string, string>;
 
 /**
  * @brief Throw a CaosDB Exception inside Octave.
diff --git a/src/private/maox_info.cpp b/src/private/maox_info.cpp
index e268da828e7be000db9dfdf161641d2cf6ab726e..226e280167165c5aadc9914da24b2b61b824cc30 100644
--- a/src/private/maox_info.cpp
+++ b/src/private/maox_info.cpp
@@ -13,22 +13,23 @@ using caosdb::connection::Connection;
 using caosdb::connection::ConnectionManager;
 using std::string;
 
-mxArray *info(const string &connection_name);
+auto info(const string &connection_name) -> mxArray *;
 
 /**
  * The implementation of the info retrieval.
  */
-mxArray *info(string const &connection_name) {
-  std::shared_ptr<Connection> connection = NULL;
-  if (connection_name == "") {
+auto info(string const &connection_name) -> mxArray * {
+  std::shared_ptr<Connection> connection = nullptr;
+  if (connection_name.empty()) {
     connection = ConnectionManager::GetDefaultConnection();
   } else {
     connection = ConnectionManager::GetConnection(connection_name);
   }
   const auto &version_info = connection->RetrieveVersionInfo();
-  const char *keys[] = {"major", "minor", "patch", "pre_release", "build"};
-  mwSize dims[2] = {1, 1};
-  mxArray *info_struct = mxCreateStructArray(2, dims, 5, keys);
+  const char *keys[] = {"major", "minor", "patch", "pre_release", // NOLINT
+                        "build"};
+  std::array<mwSize, 2> dims = {1, 1};
+  mxArray *info_struct = mxCreateStructArray(2, dims.data(), 5, keys); // NOLINT
 
   mxSetField(info_struct, 0, "major",
              maoxdb::mxScalarUINT64(version_info.GetMajor()));
@@ -53,14 +54,15 @@ mxArray *info(string const &connection_name) {
  *
  * @return     return type
  */
-void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
+void mexFunction(int /*nlhs*/, mxArray *plhs[], int nrhs,
+                 const mxArray *prhs[]) {
 
-  string conn_name("");
+  string conn_name;
   if (nrhs >= 1 && mxGetNumberOfElements(prhs[0]) > 0) {
     conn_name = mxGetChars(prhs[0]);
   }
   try {
-    auto info_struct = info(conn_name);
+    auto *info_struct = info(conn_name);
     plhs[0] = info_struct;
   } catch (const caosdb::exceptions::Exception &exc) {
     mexPrintf("Some exception!");