diff --git a/book/thebe_lite/libs/106.index.js b/book/thebe_lite/106.index.js
similarity index 100%
rename from book/thebe_lite/libs/106.index.js
rename to book/thebe_lite/106.index.js
diff --git a/book/thebe_lite/libs/106.index.js.map b/book/thebe_lite/106.index.js.map
similarity index 100%
rename from book/thebe_lite/libs/106.index.js.map
rename to book/thebe_lite/106.index.js.map
diff --git a/book/thebe_lite/libs/328.thebe-lite.min.js b/book/thebe_lite/328.thebe-lite.min.js
similarity index 100%
rename from book/thebe_lite/libs/328.thebe-lite.min.js
rename to book/thebe_lite/328.thebe-lite.min.js
diff --git a/book/thebe_lite/libs/328.thebe-lite.min.js.map b/book/thebe_lite/328.thebe-lite.min.js.map
similarity index 100%
rename from book/thebe_lite/libs/328.thebe-lite.min.js.map
rename to book/thebe_lite/328.thebe-lite.min.js.map
diff --git a/book/thebe_lite/libs/330.index.js b/book/thebe_lite/330.index.js
similarity index 100%
rename from book/thebe_lite/libs/330.index.js
rename to book/thebe_lite/330.index.js
diff --git a/book/thebe_lite/libs/330.index.js.map b/book/thebe_lite/330.index.js.map
similarity index 100%
rename from book/thebe_lite/libs/330.index.js.map
rename to book/thebe_lite/330.index.js.map
diff --git a/book/thebe_lite/libs/562.thebe-lite.min.js b/book/thebe_lite/562.thebe-lite.min.js
similarity index 100%
rename from book/thebe_lite/libs/562.thebe-lite.min.js
rename to book/thebe_lite/562.thebe-lite.min.js
diff --git a/book/thebe_lite/libs/562.thebe-lite.min.js.map b/book/thebe_lite/562.thebe-lite.min.js.map
similarity index 100%
rename from book/thebe_lite/libs/562.thebe-lite.min.js.map
rename to book/thebe_lite/562.thebe-lite.min.js.map
diff --git a/book/thebe_lite/libs/609.thebe-lite.min.js b/book/thebe_lite/609.thebe-lite.min.js
similarity index 100%
rename from book/thebe_lite/libs/609.thebe-lite.min.js
rename to book/thebe_lite/609.thebe-lite.min.js
diff --git a/book/thebe_lite/libs/609.thebe-lite.min.js.map b/book/thebe_lite/609.thebe-lite.min.js.map
similarity index 100%
rename from book/thebe_lite/libs/609.thebe-lite.min.js.map
rename to book/thebe_lite/609.thebe-lite.min.js.map
diff --git a/book/thebe_lite/libs/686.thebe-lite.min.js b/book/thebe_lite/686.thebe-lite.min.js
similarity index 100%
rename from book/thebe_lite/libs/686.thebe-lite.min.js
rename to book/thebe_lite/686.thebe-lite.min.js
diff --git a/book/thebe_lite/libs/686.thebe-lite.min.js.map b/book/thebe_lite/686.thebe-lite.min.js.map
similarity index 100%
rename from book/thebe_lite/libs/686.thebe-lite.min.js.map
rename to book/thebe_lite/686.thebe-lite.min.js.map
diff --git a/book/thebe_lite/code.css b/book/thebe_lite/_static/code.css
similarity index 100%
rename from book/thebe_lite/code.css
rename to book/thebe_lite/_static/code.css
diff --git a/book/thebe_lite/sphinx-thebe.js b/book/thebe_lite/_static/sphinx-thebe.js
similarity index 93%
rename from book/thebe_lite/sphinx-thebe.js
rename to book/thebe_lite/_static/sphinx-thebe.js
index 45a81e68f6c41b0fcb1ff3371ba1ff76e1cd47b1..cd4e18b02f48746c6660fc009303c69627c0a45a 100644
--- a/book/thebe_lite/sphinx-thebe.js
+++ b/book/thebe_lite/_static/sphinx-thebe.js
@@ -62,15 +62,23 @@ function finalizeCodeCells(cells) {
       };
 
       const exampleCell = thebe.notebook.lastCell();
-      const newNotebookCell = Object.assign({}, exampleCell);
-      newNotebookCell.__proto__ = exampleCell.__proto__;
-      newNotebookCell.id = newCellInfo.id;
-      newNotebookCell.events._id = newCellInfo.id;
-      newNotebookCell.events._object = newNotebookCell;
-      newNotebookCell.source = "";
+      const newNotebookCell = new exampleCell.constructor(
+        newCellInfo.id,
+        thebe.notebook.id,
+        "",
+        exampleCell.events._config,
+        exampleCell.metadata,
+        exampleCell.rendermine
+      );
+
+      // Manually attach kernel session
+      // The attachSession function only sends out a couple of events we don't care about
+      newNotebookCell.session = exampleCell.session;
 
       thebe.notebook.cells.push(newNotebookCell);
 
+      console.log(newNotebookCell.area);
+
       thebe.renderAllCells(
         {
           mountRunButton: true,
@@ -90,6 +98,12 @@ function finalizeCodeCells(cells) {
       addToThebeControls(newCell, deleteCell);
       deleteCell.onclick = () => {
         newCell.remove();
+        let cells = thebe.notebook.cells;
+        // Remove cell from notebook too, otherwise their side-effects will still be present when running all
+        cells.splice(
+          cells.findIndex((cell) => cell.id === newCellInfo.id),
+          1
+        );
       };
     };
   });
diff --git a/book/thebe_lite/libs/api/contents/all.json b/book/thebe_lite/api/contents/all.json
similarity index 100%
rename from book/thebe_lite/libs/api/contents/all.json
rename to book/thebe_lite/api/contents/all.json
diff --git a/book/thebe_lite/libs/index.js b/book/thebe_lite/index.js
similarity index 100%
rename from book/thebe_lite/libs/index.js
rename to book/thebe_lite/index.js
diff --git a/book/thebe_lite/libs/index.js.map b/book/thebe_lite/index.js.map
similarity index 100%
rename from book/thebe_lite/libs/index.js.map
rename to book/thebe_lite/index.js.map
diff --git a/book/thebe_lite/libs/pypi/all.json b/book/thebe_lite/pypi/all.json
similarity index 100%
rename from book/thebe_lite/libs/pypi/all.json
rename to book/thebe_lite/pypi/all.json
diff --git a/book/thebe_lite/libs/pypi/ipykernel-6.9.2-py3-none-any.whl b/book/thebe_lite/pypi/ipykernel-6.9.2-py3-none-any.whl
similarity index 100%
rename from book/thebe_lite/libs/pypi/ipykernel-6.9.2-py3-none-any.whl
rename to book/thebe_lite/pypi/ipykernel-6.9.2-py3-none-any.whl
diff --git a/book/thebe_lite/libs/pypi/piplite-0.0.8-py3-none-any.whl b/book/thebe_lite/pypi/piplite-0.0.8-py3-none-any.whl
similarity index 100%
rename from book/thebe_lite/libs/pypi/piplite-0.0.8-py3-none-any.whl
rename to book/thebe_lite/pypi/piplite-0.0.8-py3-none-any.whl
diff --git a/book/thebe_lite/libs/pypi/pyodide_kernel-0.0.8-py3-none-any.whl b/book/thebe_lite/pypi/pyodide_kernel-0.0.8-py3-none-any.whl
similarity index 100%
rename from book/thebe_lite/libs/pypi/pyodide_kernel-0.0.8-py3-none-any.whl
rename to book/thebe_lite/pypi/pyodide_kernel-0.0.8-py3-none-any.whl
diff --git a/book/thebe_lite/libs/pypi/widgetsnbextension-3.6.4-py3-none-any.whl b/book/thebe_lite/pypi/widgetsnbextension-3.6.4-py3-none-any.whl
similarity index 100%
rename from book/thebe_lite/libs/pypi/widgetsnbextension-3.6.4-py3-none-any.whl
rename to book/thebe_lite/pypi/widgetsnbextension-3.6.4-py3-none-any.whl
diff --git a/book/thebe_lite/libs/pypi/widgetsnbextension-4.0.7-py3-none-any.whl b/book/thebe_lite/pypi/widgetsnbextension-4.0.7-py3-none-any.whl
similarity index 100%
rename from book/thebe_lite/libs/pypi/widgetsnbextension-4.0.7-py3-none-any.whl
rename to book/thebe_lite/pypi/widgetsnbextension-4.0.7-py3-none-any.whl
diff --git a/book/thebe_lite/libs/service-worker-dddfe83.js b/book/thebe_lite/service-worker-dddfe83.js
similarity index 100%
rename from book/thebe_lite/libs/service-worker-dddfe83.js
rename to book/thebe_lite/service-worker-dddfe83.js
diff --git a/book/thebe_lite/libs/thebe-lite.min.js b/book/thebe_lite/thebe-lite.min.js
similarity index 100%
rename from book/thebe_lite/libs/thebe-lite.min.js
rename to book/thebe_lite/thebe-lite.min.js
diff --git a/book/thebe_lite/libs/thebe-lite.min.js.map b/book/thebe_lite/thebe-lite.min.js.map
similarity index 100%
rename from book/thebe_lite/libs/thebe-lite.min.js.map
rename to book/thebe_lite/thebe-lite.min.js.map
diff --git a/book/thebe_lite/libs/thebe.css b/book/thebe_lite/thebe.css
similarity index 100%
rename from book/thebe_lite/libs/thebe.css
rename to book/thebe_lite/thebe.css
diff --git a/book/thebe_lite/libs/types/activate.d.ts b/book/thebe_lite/types/activate.d.ts
similarity index 100%
rename from book/thebe_lite/libs/types/activate.d.ts
rename to book/thebe_lite/types/activate.d.ts
diff --git a/book/thebe_lite/libs/types/codemirror.d.ts b/book/thebe_lite/types/codemirror.d.ts
similarity index 100%
rename from book/thebe_lite/libs/types/codemirror.d.ts
rename to book/thebe_lite/types/codemirror.d.ts
diff --git a/book/thebe_lite/libs/types/index.d.ts b/book/thebe_lite/types/index.d.ts
similarity index 100%
rename from book/thebe_lite/libs/types/index.d.ts
rename to book/thebe_lite/types/index.d.ts
diff --git a/book/thebe_lite/libs/types/options.d.ts b/book/thebe_lite/types/options.d.ts
similarity index 100%
rename from book/thebe_lite/libs/types/options.d.ts
rename to book/thebe_lite/types/options.d.ts
diff --git a/book/thebe_lite/libs/types/render.d.ts b/book/thebe_lite/types/render.d.ts
similarity index 100%
rename from book/thebe_lite/libs/types/render.d.ts
rename to book/thebe_lite/types/render.d.ts
diff --git a/book/thebe_lite/libs/types/status.d.ts b/book/thebe_lite/types/status.d.ts
similarity index 100%
rename from book/thebe_lite/libs/types/status.d.ts
rename to book/thebe_lite/types/status.d.ts
diff --git a/book/thebe_lite/libs/types/thebe.d.ts b/book/thebe_lite/types/thebe.d.ts
similarity index 100%
rename from book/thebe_lite/libs/types/thebe.d.ts
rename to book/thebe_lite/types/thebe.d.ts
diff --git a/book/thebe_lite/libs/types/types.d.ts b/book/thebe_lite/types/types.d.ts
similarity index 100%
rename from book/thebe_lite/libs/types/types.d.ts
rename to book/thebe_lite/types/types.d.ts
diff --git a/book/thebe_lite/libs/types/utils.d.ts b/book/thebe_lite/types/utils.d.ts
similarity index 100%
rename from book/thebe_lite/libs/types/utils.d.ts
rename to book/thebe_lite/types/utils.d.ts
diff --git a/build-lite.sh b/build-lite.sh
index eeeb7be6fa3124ce1ac45e30ab9d5696553e8a78..9a0a9d1fe7216d00a6a90386c99cb466773469f6 100755
--- a/build-lite.sh
+++ b/build-lite.sh
@@ -1,8 +1,7 @@
 #!/bin/sh
 
 jupyter-book build book
-cp book/thebe_lite/libs/* book/_build/html -r
-cp book/thebe_lite/* book/_build/html/_static
+cp book/thebe_lite/* book/_build/html/ -r
 
 if command -v python > /dev/null 2>&1
 then
@@ -18,7 +17,7 @@ else
 fi
 
 # Copy all non notebook, markdown or build files into the build for local access in pyodide etc.
-find book/ | grep -v "^book/_.*\|.*\.\(md\|ipynb\)\|thebe_lite" | grep "\." | cut -c 6- | xargs -i sh -c 'echo "book/_build/html/{}" | grep -o "^.*/" | xargs -d "\n" mkdir -p; cp book/"{}" book/_build/html/"{}"'
+find book/ -exec test -f {} \; -print | grep -v "^book/_.*\|.*\.\(md\|ipynb\)\|thebe_lite" | cut -c 6- | xargs -i sh -c 'echo "book/_build/html/{}" | grep -o "^.*/" | xargs -d "\n" mkdir -p; cp book/"{}" book/_build/html/"{}"'
 
-$python_command -m http.server 8000 --directory book/_build/html &
+$python_command -m http.server 8000 --directory book/_build/html