diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 39319c05661b02cd562763d21b1402f83da8cc33..98e8ca3a43a6d3821409b36e759a20b656d6d3bb 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -20,6 +20,7 @@ before_script:
     libxml2-dev 
     pkg-config
     pybind11-dev
+    python3
     python3-dev python3-numpy
 
 aoflagger:
@@ -30,4 +31,5 @@ aoflagger:
     - make
     - make install
     - make check
-
+    - cd python
+    - echo "import aoflagger"|python3
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000000000000000000000000000000000000..7676f3941e6122f4f35162fa355e668553cf52cd
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "external/pybind11"]
+	path = external/pybind11
+	url = https://github.com/pybind/pybind11.git
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7f01e7200a3affd20770eb8ba588d12f23a4397b..6ccee3db486eb94589284edcea8e4bd27a8c17f2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -14,46 +14,64 @@ find_package(PkgConfig)
 pkg_check_modules(GTKMM gtkmm-3.0>=3.0.0)
 pkg_check_modules(SIGCXX sigc++-2.0)
 
-include_directories(${CMAKE_SOURCE_DIR}/aocommon/include)
+# Find and include git submodules
+find_package(Git QUIET)
+if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
+# Update submodules as needed
+    option(GIT_SUBMODULE "Check submodules during build" ON)
+    if(GIT_SUBMODULE)
+        message(STATUS "Submodule update")
+        execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive --checkout
+                        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+                        RESULT_VARIABLE GIT_SUBMOD_RESULT)
+        if(NOT GIT_SUBMOD_RESULT EQUAL "0")
+            message(FATAL_ERROR "git submodule update --init failed with ${GIT_SUBMOD_RESULT}, please checkout submodules")
+        endif()
+    endif()
+endif()
+
+# Include aocommon/pybind11 headers
+include_directories("${CMAKE_SOURCE_DIR}/aocommon/include")
+add_subdirectory("${CMAKE_SOURCE_DIR}/external/pybind11")
+include_directories(${pybind11_INCLUDE_DIR})
 
 set(CASACORE_MAKE_REQUIRED_EXTERNALS_OPTIONAL TRUE)
 find_package(Casacore REQUIRED COMPONENTS casa ms tables measures)
+include_directories(${CASACORE_INCLUDE_DIRS})
 
 find_package(CFITSIO REQUIRED)
+include_directories(${CFITSIO_INCLUDE_DIR})
 
 find_path(FFTW3_INCLUDE_DIR NAMES fftw3.h)
 
 find_library(GSL_LIB NAMES gsl)
 find_library(GSL_CBLAS_LIB NAMES gslcblas)
 find_path(GSL_INCLUDE_DIR NAMES gsl/gsl_version.h)
+if(GSL_INCLUDE_DIR)
+  include_directories(${GSL_INCLUDE_DIR})
+endif(GSL_INCLUDE_DIR)
 
 find_package(Threads REQUIRED)
 find_package(LibXml2 REQUIRED)
+include_directories(${LIBXML2_INCLUDE_DIR})
+
 find_package(PNG REQUIRED)
 find_package(PythonLibs 3 REQUIRED)
 find_package(PythonInterp REQUIRED)
 message(STATUS "Using python version ${PYTHON_VERSION_STRING}")
-find_package(pybind11 REQUIRED)
+include_directories(${PYTHON_INCLUDE_DIRS})
 
-set(Boost_NO_BOOST_CMAKE ON)
 # boost::alignment requires Boost 1.56
 find_package(Boost 1.56.0 REQUIRED COMPONENTS date_time filesystem system unit_test_framework)
+include_directories(${Boost_INCLUDE_DIR})
+
 find_library(FFTW3_LIB fftw3 REQUIRED)
+include_directories(${FFTW3_INCLUDE_DIR})
+
 enable_language(Fortran OPTIONAL)
 find_package(BLAS REQUIRED)
 find_package(LAPACK REQUIRED)
 find_package(Lua 5.2 REQUIRED)
-
-include_directories(${pybind11_INCLUDE_DIR})
-include_directories(${CASACORE_INCLUDE_DIRS})
-include_directories(${Boost_INCLUDE_DIR})
-include_directories(${LIBXML2_INCLUDE_DIR})
-include_directories(${CFITSIO_INCLUDE_DIR})
-include_directories(${FFTW3_INCLUDE_DIR})
-if(GSL_INCLUDE_DIR)
-	include_directories(${GSL_INCLUDE_DIR})
-endif(GSL_INCLUDE_DIR)
-include_directories(${PYTHON_INCLUDE_DIRS})
 include_directories(${LUA_INCLUDE_DIR})
 
 # The following stuff will set the "rpath" correctly, so that
diff --git a/CMakeVersionInfo.txt b/CMakeVersionInfo.txt
index a1dc8eb15db495becd53ffe93ff1d91a6011f531..6ef40bad0ac8c1fa63d32d00bf01f380d2ab135e 100644
--- a/CMakeVersionInfo.txt
+++ b/CMakeVersionInfo.txt
@@ -1,8 +1,8 @@
 set(AOFLAGGER_VERSION_STR   3.0)
 set(AOFLAGGER_VERSION_MAJOR 3)
 set(AOFLAGGER_VERSION_MINOR 0)
-set(AOFLAGGER_VERSION_SUBMINOR 1)
-set(AOFLAGGER_VERSION_DATE_STR 2020-12-09)
+set(AOFLAGGER_VERSION_SUBMINOR 2)
+set(AOFLAGGER_VERSION_DATE_STR 2021-01-02)
 
 # SOVERSION stored in the library -- increase
 # when making ABI changes
diff --git a/external/pybind11 b/external/pybind11
new file mode 160000
index 0000000000000000000000000000000000000000..98f1bbb8004f654ba9e26717bdf5912fb899b05a
--- /dev/null
+++ b/external/pybind11
@@ -0,0 +1 @@
+Subproject commit 98f1bbb8004f654ba9e26717bdf5912fb899b05a
diff --git a/scripts/docker/Dockerfile b/scripts/docker/Dockerfile
index 3aa509c1b7bb2687c72a6f8e67d61182e0d4696c..5c380c765bafc53f529b2cd703fcb241ff21f183 100644
--- a/scripts/docker/Dockerfile
+++ b/scripts/docker/Dockerfile
@@ -1,4 +1,4 @@
-FROM kernsuite/base:4
+FROM ubuntu:18.04
 
 RUN export DEBIAN_FRONTEND=noninteractive && apt-get update && \
     apt-get install -y \
@@ -8,10 +8,10 @@ RUN export DEBIAN_FRONTEND=noninteractive && apt-get update && \
     casacore-data casacore-dev \
     libblas-dev liblapack-dev \
     liblua5.3-dev \
+    python3 \
     libpython3-dev \
-    pybind11-dev \
     libboost-date-time-dev libboost-test-dev \
-      libboost-system-dev libboost-filesystem-dev \
+    libboost-system-dev libboost-filesystem-dev \
     libgtkmm-3.0-dev \
     libcfitsio-dev \
     libfftw3-dev \
@@ -24,4 +24,6 @@ WORKDIR /src
 
 RUN mkdir /build && cd /build && cmake ../src
 
-RUN cd /build && make -j2 && make install && make check -j2
+RUN cd /build && make -j24 && make install && make check -j24
+
+RUN cd /build/python && echo "import aoflagger" | python3
diff --git a/scripts/docker/Dockerfile-nogui b/scripts/docker/Dockerfile-nogui
index d94a477fa7de605de1ca23ec6de6347e80f473bc..80ec19f85018d7848ebbeba36fa4dd98f14f2ac9 100644
--- a/scripts/docker/Dockerfile-nogui
+++ b/scripts/docker/Dockerfile-nogui
@@ -1,4 +1,4 @@
-FROM kernsuite/base:4
+FROM ubuntu:18.04
 
 RUN export DEBIAN_FRONTEND=noninteractive && apt-get update && \
     apt-get install -y \
@@ -8,10 +8,10 @@ RUN export DEBIAN_FRONTEND=noninteractive && apt-get update && \
     casacore-data casacore-dev \
     libblas-dev liblapack-dev \
     liblua5.3-dev \
+    python3 \
     libpython3-dev \
-    pybind11-dev \
     libboost-date-time-dev libboost-test-dev \
-      libboost-system-dev libboost-filesystem-dev \
+    libboost-system-dev libboost-filesystem-dev \
     libcfitsio-dev \
     libfftw3-dev \
     libxml2-dev \
@@ -24,3 +24,5 @@ WORKDIR /src
 RUN mkdir /build && cd /build && cmake ../src
 
 RUN cd /build && make -j2 && make install && make check -j2
+
+RUN cd /build/python && echo "import aoflagger" | python3