diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 4d1cf8758cb67b1b70d7500e81309a91dd5863e1..475fd78a9045bc9e48276bb3b608741285bd7e9e 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,7 +1,6 @@
 image: python:3.10-bullseye
 
 stages:
-  - test
   - build
   - deploy
 
@@ -13,39 +12,65 @@ cache:
     - .cache/pip
     - venv/
 
-# Before running other jobs, setup Python
 before_script:
   - python -V
   - pip install virtualenv
   - virtualenv venv
   - source venv/bin/activate
+  - pip install -r requirements.txt
 
-# This job tests if the book compiles gracefully after a new addition
-test-build:
-  stage: test
+build-book:
+  stage: build
+  script:
+    - |
+      if [ "$CI_COMMIT_BRANCH" == "publish" ]; then
+        echo "Building production version"
+        teachbooks build --publish book/ > >(tee stdout.log) 2> >(tee stderr.log >&2)
+      else
+        echo "Building draft version"
+        teachbooks build book/ > >(tee stdout.log) 2> >(tee stderr.log >&2)
+      fi
+    - echo $CI_JOB_ID > build_job_id.txt
+  artifacts:
+    paths:
+      - book/_build/html
+      - stdout.log
+      - stderr.log
+      - build_job_id.txt
+    expire_in: 1 week
   rules:
-    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
-    - if: $CI_COMMIT_BRANCH == "main" && $CI_PIPELINE_SOURCE == "push"
-    - if: $CI_COMMIT_BRANCH == "publish" && $CI_PIPELINE_SOURCE == "push"
+    - if: $CI_COMMIT_BRANCH == "main" || $CI_COMMIT_BRANCH == "publish"
+    - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "publish"
+      when: always
+
+deploy-draft:
+  stage: deploy
+  needs: ["build-book"]
   script:
-    - pip install -r requirements.txt
-    - jupyter-book clean book/
-    - jupyter-book build book/
+    - BUILD_JOB_ID=$(cat build_job_id.txt)
+    - |
+      curl -X POST https://mude.citg.tudelft.nl/hooks/book-deploy-draft \
+      -H "Content-Type: application/json" \
+      -H "X-Gitlab-Token: glpat-m4CzsDqHnXNn3Pf5Whyd" \
+      -d "{\"object_kind\":\"pipeline\",\"object_attributes\":{\"status\":\"success\",\"ref\":\"main\"},\"build_job_id\":$BUILD_JOB_ID}"
+  environment:
+    name: draft
+    url: https://mude.citg.tudelft.nl/2024/book/draft
+  rules:
+    - if: $CI_COMMIT_BRANCH == "main"
 
-# This job commits the built HTML to the publish-html branch
-# push-html:
-#   stage: deploy
-#   only:
-#     - publish
-#   before_script:
-#     - apt-get update -y
-#     - apt-get install rsync -y
-#     - git config --global user.name "$GITLAB_USER_NAME"
-#     - git config --global user.email "$GITLAB_USER_EMAIL"
-#     - git fetch origin publish-html
-#     - git checkout publish-html
-#   script:
-#     - rsync -av --delete-after --exclude=".git/" --exclude=".cache/" --exclude="venv/" ./book/_build/html/ .
-#     - git add --all -- ':!.cache/*'
-#     - git commit --allow-empty -m "$CI_COMMIT_MESSAGE"
-#     - git push https://gitlab-ci-token:$ACCESS_TOKEN@gitlab.tudelft.nl/$CI_PROJECT_PATH.git publish-html
+deploy-production:
+  stage: deploy
+  needs: ["build-book"]
+  script:
+    - BUILD_JOB_ID=$(cat build_job_id.txt)
+    - |
+      curl -X POST https://mude.citg.tudelft.nl/hooks/book-deploy-production \
+      -H "Content-Type: application/json" \
+      -H "X-Gitlab-Token: glpat-m4CzsDqHnXNn3Pf5Whyd" \
+      -d "{\"object_kind\":\"pipeline\",\"object_attributes\":{\"status\":\"success\",\"ref\":\"publish\"},\"build_job_id\":$BUILD_JOB_ID}"
+  environment:
+    name: production
+    url: https://mude.citg.tudelft.nl/2024/book
+  rules:
+    - if: $CI_COMMIT_BRANCH == "publish"
\ No newline at end of file
diff --git a/book/.teachbooks/server/state.pickle b/book/.teachbooks/server/state.pickle
new file mode 100644
index 0000000000000000000000000000000000000000..b1c31b779db9b010bd8bd0438bf984116d34a223
Binary files /dev/null and b/book/.teachbooks/server/state.pickle differ
diff --git a/book/_config.yml b/book/_config.yml
index f211004568319afa0542a44bac9b8c4e9618191b..11f541166e0aaaae1a9c7b1477585335accf3313 100644
--- a/book/_config.yml
+++ b/book/_config.yml
@@ -12,12 +12,18 @@ sphinx:
   config:
     # Bibliography style
     bibtex_reference_style: author_year
-    html_js_files:
-      - https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js
     patch_config:
       disabled-patches: []
     html_show_copyright: false
     html_last_updated_fmt: '%B %-d, %Y'
+    html_js_files:
+    - https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js
+    thebe_config:
+      use_thebe_lite: true
+      exclude_patterns: ["**/_*.yml", "**/*.md", "**/*.ipynb"]
+    html_theme_options:
+      launch_buttons:
+        thebe: true
   extra_extensions:
     - sphinx_inline_tabs
     - sphinx_grasple
@@ -29,10 +35,8 @@ sphinx:
 bibtex_bibfiles:
   - _bibliography/references_pd.bib
 
-launch_buttons:
-  thebe: true
-
 html:
+  # announcement: "Content in this book will be released one week at a time, beginning Sep 3."
   # announcement: "<p>This book is archived from the 2023-24 academic year. The most recent version is at <a href='https://mude.citg.tudelft.nl/book' style='color: cyan;'>mude.citg.tudelft.nl/book</a>; find out more at the <a href='https://mude.citg.tudelft.nl/archive' target='_blank' style='color: cyan;'>MUDE Archive</a>.</p>"
   use_multitoc_numbering: false
   # comments:
diff --git a/book/intro.md b/book/intro.md
index 297e26070b55e691ddd9588da8c259a680487954..c55878d0cdf2b5f0d7d4cbf2266a239b20df8803 100644
--- a/book/intro.md
+++ b/book/intro.md
@@ -9,7 +9,6 @@ For now, you can read the course description [here](https://www.studiegids.tudel
 Material from last year is also available, but note that this should be used for general information only as **the material can change significantly!**
 - Use these links to visit the [book](https://mude.citg.tudelft.nl/2023/) and [website](https://mude.citg.tudelft.nl/2023/book) from last year.
 - For more information, visit the [MUDE Archive](https://mude.citg.tudelft.nl/archive/).
-
 ````
 
 
diff --git a/requirements.txt b/requirements.txt
index 739676f21fa2f6d600eab969db26a1fe6d669fbe..1465dbe93ce9a9b6f9a16609edc4b373909d14b8 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -9,3 +9,5 @@ docutils == 0.17.1
 --extra-index-url https://gitlab.tudelft.nl/api/v4/projects/17983/packages/pypi/simple
 jupyterbook_patches ~= 0.1.4
 
+--extra-index-url https://gitlab.tudelft.nl/api/v4/projects/11239/packages/pypi/simple
+sphinx-thebe ~= 0.9.9