Repository: YM162/gulagcleaner (language: python)

Issue:
Added renaming function
When a file is uploaded, the output file is renamed without the "gulag" naming and the original file is deleted


Discussion / hints:
al modificar un pdf, lo devuelve sin el prefijo y borra el original
moved file to the correct location

Fix patch:
diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml
new file mode 100644
index 0000000..7dfd4bf
--- /dev/null
+++ b/.github/workflows/rust.yml
@@ -0,0 +1,31 @@
+name: Test and Build Rust
+
+on:
+  push:
+  pull_request:
+  # schedule:
+  # Check if it works with current dependencies (weekly on Friday 00:00  UTC)
+  #   - cron: '0 0 * * 5'
+
+jobs:
+  test:
+    name: Test
+    runs-on: ubuntu-latest
+
+    steps:
+      - uses: actions/checkout@v3
+
+      - name: Setup Rust
+        uses: actions-rs/toolchain@v1
+        with:
+          components: clippy
+          override: true
+          profile: minimal
+          toolchain: stable
+
+      - uses: actions/checkout@v3
+      - name: Run clippy
+        working-directory: ./gulagcleaner_rs
+        run: |
+          cargo clippy --verbose --all-targets --all-features -- -D warnings
+          cargo test --verbose --all-features
diff --git a/.gitignore b/.gitignore
index fb32e01..f090327 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,11 +1,28 @@
-dist
+.env
+useful_info+scripts+TODO.md
 multiplepdf
+
+# javaScript
+dist
+
+# python
 tests.ipynb
 gulagcleaner.egg-info
-gulagcleaner/__pycache__
-target
-useful_info+scripts+TODO.md
-.env
+__pycache__
 .venv
-python/gulagcleaner/__pycache__
-*.pyd
\ No newline at end of file
+*.pyd
+
+#rust
+
+debug/
+target/
+
+# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
+# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
+Cargo.lock
+
+# These are backup files generated by rustfmt
+**/*.rs.bk
+
+# MSVC Windows builds of rustc generate these, which store debugging information
+*.pdb
\ No newline at end of file
diff --git a/Cargo.lock b/Cargo.lock
deleted file mode 100644
index 35bc477..0000000
--- a/Cargo.lock
+++ /dev/null
@@ -1,698 +0,0 @@
-# This file is automatically @generated by Cargo.
-# It is not intended for manual editing.
-version = 3
-
-[[package]]
-name = "adler"
-version = "1.0.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
-
-[[package]]
-name = "android-tzdata"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0"
-
-[[package]]
-name = "android_system_properties"
-version = "0.1.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311"
-dependencies = [
- "libc",
-]
-
-[[package]]
-name = "autocfg"
-version = "1.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
-
-[[package]]
-name = "bitflags"
-version = "1.3.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
-
-[[package]]
-name = "bumpalo"
-version = "3.14.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec"
-
-[[package]]
-name = "cc"
-version = "1.0.83"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0"
-dependencies = [
- "libc",
-]
-
-[[package]]
-name = "cfg-if"
-version = "1.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
-
-[[package]]
-name = "chrono"
-version = "0.4.31"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38"
-dependencies = [
- "android-tzdata",
- "iana-time-zone",
- "num-traits",
- "windows-targets",
-]
-
-[[package]]
-name = "core-foundation-sys"
-version = "0.8.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f"
-
-[[package]]
-name = "crc32fast"
-version = "1.3.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d"
-dependencies = [
- "cfg-if",
-]
-
-[[package]]
-name = "crossbeam-deque"
-version = "0.8.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fca89a0e215bab21874660c67903c5f143333cab1da83d041c7ded6053774751"
-dependencies = [
- "cfg-if",
- "crossbeam-epoch",
- "crossbeam-utils",
-]
-
-[[package]]
-name = "crossbeam-epoch"
-version = "0.9.16"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2d2fe95351b870527a5d09bf563ed3c97c0cffb87cf1c78a591bf48bb218d9aa"
-dependencies = [
- "autocfg",
- "cfg-if",
- "crossbeam-utils",
- "memoffset",
-]
-
-[[package]]
-name = "crossbeam-utils"
-version = "0.8.17"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c06d96137f14f244c37f989d9fff8f95e6c18b918e71f36638f8c49112e4c78f"
-dependencies = [
- "cfg-if",
-]
-
-[[package]]
-name = "deranged"
-version = "0.3.10"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8eb30d70a07a3b04884d2677f06bec33509dc67ca60d92949e5535352d3191dc"
-dependencies = [
- "powerfmt",
-]
-
-[[package]]
-name = "either"
-version = "1.9.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07"
-
-[[package]]
-name = "encoding_rs"
-version = "0.8.33"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1"
-dependencies = [
- "cfg-if",
-]
-
-[[package]]
-name = "flate2"
-version = "1.0.28"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e"
-dependencies = [
- "crc32fast",
- "miniz_oxide",
-]
-
-[[package]]
-name = "gulagcleaner_python"
-version = "0.11.0"
-dependencies = [
- "gulagcleaner_rs",
- "pyo3",
-]
-
-[[package]]
-name = "gulagcleaner_rs"
-version = "0.11.0"
-dependencies = [
- "flate2",
- "lopdf",
-]
-
-[[package]]
-name = "gulagcleaner_wasm"
-version = "0.11.0"
-dependencies = [
- "gulagcleaner_rs",
- "serde",
- "serde-wasm-bindgen",
- "wasm-bindgen",
-]
-
-[[package]]
-name = "heck"
-version = "0.4.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
-
-[[package]]
-name = "iana-time-zone"
-version = "0.1.58"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20"
-dependencies = [
- "android_system_properties",
- "core-foundation-sys",
- "iana-time-zone-haiku",
- "js-sys",
- "wasm-bindgen",
- "windows-core",
-]
-
-[[package]]
-name = "iana-time-zone-haiku"
-version = "0.1.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f"
-dependencies = [
- "cc",
-]
-
-[[package]]
-name = "indoc"
-version = "2.0.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1e186cfbae8084e513daff4240b4797e342f988cecda4fb6c939150f96315fd8"
-
-[[package]]
-name = "itoa"
-version = "1.0.10"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c"
-
-[[package]]
-name = "js-sys"
-version = "0.3.66"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca"
-dependencies = [
- "wasm-bindgen",
-]
-
-[[package]]
-name = "libc"
-version = "0.2.151"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4"
-
-[[package]]
-name = "linked-hash-map"
-version = "0.5.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f"
-
-[[package]]
-name = "lock_api"
-version = "0.4.11"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45"
-dependencies = [
- "autocfg",
- "scopeguard",
-]
-
-[[package]]
-name = "log"
-version = "0.4.20"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
-
-[[package]]
-name = "lopdf"
-version = "0.31.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "07c8e1b6184b1b32ea5f72f572ebdc40e5da1d2921fa469947ff7c480ad1f85a"
-dependencies = [
- "chrono",
- "encoding_rs",
- "flate2",
- "itoa",
- "linked-hash-map",
- "log",
- "md5",
- "nom",
- "rayon",
- "time",
- "weezl",
-]
-
-[[package]]
-name = "md5"
-version = "0.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "490cc448043f947bae3cbee9c203358d62dbee0db12107a74be5c30ccfd09771"
-
-[[package]]
-name = "memchr"
-version = "2.6.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167"
-
-[[package]]
-name = "memoffset"
-version = "0.9.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c"
-dependencies = [
- "autocfg",
-]
-
-[[package]]
-name = "minimal-lexical"
-version = "0.2.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
-
-[[package]]
-name = "miniz_oxide"
-version = "0.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7"
-dependencies = [
- "adler",
-]
-
-[[package]]
-name = "nom"
-version = "7.1.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
-dependencies = [
- "memchr",
- "minimal-lexical",
-]
-
-[[package]]
-name = "num-traits"
-version = "0.2.17"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c"
-dependencies = [
- "autocfg",
-]
-
-[[package]]
-name = "once_cell"
-version = "1.19.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
-
-[[package]]
-name = "parking_lot"
-version = "0.12.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
-dependencies = [
- "lock_api",
- "parking_lot_core",
-]
-
-[[package]]
-name = "parking_lot_core"
-version = "0.9.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e"
-dependencies = [
- "cfg-if",
- "libc",
- "redox_syscall",
- "smallvec",
- "windows-targets",
-]
-
-[[package]]
-name = "powerfmt"
-version = "0.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391"
-
-[[package]]
-name = "proc-macro2"
-version = "1.0.71"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "75cb1540fadbd5b8fbccc4dddad2734eba435053f725621c070711a14bb5f4b8"
-dependencies = [
- "unicode-ident",
-]
-
-[[package]]
-name = "pyo3"
-version = "0.20.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "04e8453b658fe480c3e70c8ed4e3d3ec33eb74988bd186561b0cc66b85c3bc4b"
-dependencies = [
- "cfg-if",
- "indoc",
- "libc",
- "memoffset",
- "parking_lot",
- "pyo3-build-config",
- "pyo3-ffi",
- "pyo3-macros",
- "unindent",
-]
-
-[[package]]
-name = "pyo3-build-config"
-version = "0.20.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a96fe70b176a89cff78f2fa7b3c930081e163d5379b4dcdf993e3ae29ca662e5"
-dependencies = [
- "once_cell",
- "target-lexicon",
-]
-
-[[package]]
-name = "pyo3-ffi"
-version = "0.20.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "214929900fd25e6604661ed9cf349727c8920d47deff196c4e28165a6ef2a96b"
-dependencies = [
- "libc",
- "pyo3-build-config",
-]
-
-[[package]]
-name = "pyo3-macros"
-version = "0.20.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dac53072f717aa1bfa4db832b39de8c875b7c7af4f4a6fe93cdbf9264cf8383b"
-dependencies = [
- "proc-macro2",
- "pyo3-macros-backend",
- "quote",
- "syn",
-]
-
-[[package]]
-name = "pyo3-macros-backend"
-version = "0.20.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7774b5a8282bd4f25f803b1f0d945120be959a36c72e08e7cd031c792fdfd424"
-dependencies = [
- "heck",
- "proc-macro2",
- "quote",
- "syn",
-]
-
-[[package]]
-name = "quote"
-version = "1.0.33"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
-dependencies = [
- "proc-macro2",
-]
-
-[[package]]
-name = "rayon"
-version = "1.8.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9c27db03db7734835b3f53954b534c91069375ce6ccaa2e065441e07d9b6cdb1"
-dependencies = [
- "either",
- "rayon-core",
-]
-
-[[package]]
-name = "rayon-core"
-version = "1.12.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5ce3fb6ad83f861aac485e76e1985cd109d9a3713802152be56c3b1f0e0658ed"
-dependencies = [
- "crossbeam-deque",
- "crossbeam-utils",
-]
-
-[[package]]
-name = "redox_syscall"
-version = "0.4.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa"
-dependencies = [
- "bitflags",
-]
-
-[[package]]
-name = "scopeguard"
-version = "1.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
-
-[[package]]
-name = "serde"
-version = "1.0.193"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89"
-dependencies = [
- "serde_derive",
-]
-
-[[package]]
-name = "serde-wasm-bindgen"
-version = "0.6.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b9b713f70513ae1f8d92665bbbbda5c295c2cf1da5542881ae5eefe20c9af132"
-dependencies = [
- "js-sys",
- "serde",
- "wasm-bindgen",
-]
-
-[[package]]
-name = "serde_derive"
-version = "1.0.193"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
-]
-
-[[package]]
-name = "smallvec"
-version = "1.11.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970"
-
-[[package]]
-name = "syn"
-version = "2.0.42"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5b7d0a2c048d661a1a59fcd7355baa232f7ed34e0ee4df2eef3c1c1c0d3852d8"
-dependencies = [
- "proc-macro2",
- "quote",
- "unicode-ident",
-]
-
-[[package]]
-name = "target-lexicon"
-version = "0.12.12"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "14c39fd04924ca3a864207c66fc2cd7d22d7c016007f9ce846cbb9326331930a"
-
-[[package]]
-name = "time"
-version = "0.3.31"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f657ba42c3f86e7680e53c8cd3af8abbe56b5491790b46e22e19c0d57463583e"
-dependencies = [
- "deranged",
- "itoa",
- "powerfmt",
- "serde",
- "time-core",
- "time-macros",
-]
-
-[[package]]
-name = "time-core"
-version = "0.1.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3"
-
-[[package]]
-name = "time-macros"
-version = "0.2.16"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "26197e33420244aeb70c3e8c78376ca46571bc4e701e4791c2cd9f57dcb3a43f"
-dependencies = [
- "time-core",
-]
-
-[[package]]
-name = "unicode-ident"
-version = "1.0.12"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
-
-[[package]]
-name = "unindent"
-version = "0.2.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c7de7d73e1754487cb58364ee906a499937a0dfabd86bcb980fa99ec8c8fa2ce"
-
-[[package]]
-name = "wasm-bindgen"
-version = "0.2.89"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e"
-dependencies = [
- "cfg-if",
- "wasm-bindgen-macro",
-]
-
-[[package]]
-name = "wasm-bindgen-backend"
-version = "0.2.89"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826"
-dependencies = [
- "bumpalo",
- "log",
- "once_cell",
- "proc-macro2",
- "quote",
- "syn",
- "wasm-bindgen-shared",
-]
-
-[[package]]
-name = "wasm-bindgen-macro"
-version = "0.2.89"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2"
-dependencies = [
- "quote",
- "wasm-bindgen-macro-support",
-]
-
-[[package]]
-name = "wasm-bindgen-macro-support"
-version = "0.2.89"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
- "wasm-bindgen-backend",
- "wasm-bindgen-shared",
-]
-
-[[package]]
-name = "wasm-bindgen-shared"
-version = "0.2.89"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f"
-
-[[package]]
-name = "weezl"
-version = "0.1.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9193164d4de03a926d909d3bc7c30543cecb35400c02114792c2cae20d5e2dbb"
-
-[[package]]
-name = "windows-core"
-version = "0.51.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64"
-dependencies = [
- "windows-targets",
-]
-
-[[package]]
-name = "windows-targets"
-version = "0.48.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
-dependencies = [
- "windows_aarch64_gnullvm",
- "windows_aarch64_msvc",
- "windows_i686_gnu",
- "windows_i686_msvc",
- "windows_x86_64_gnu",
- "windows_x86_64_gnullvm",
- "windows_x86_64_msvc",
-]
-
-[[package]]
-name = "windows_aarch64_gnullvm"
-version = "0.48.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
-
-[[package]]
-name = "windows_aarch64_msvc"
-version = "0.48.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
-
-[[package]]
-name = "windows_i686_gnu"
-version = "0.48.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
-
-[[package]]
-name = "windows_i686_msvc"
-version = "0.48.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
-
-[[package]]
-name = "windows_x86_64_gnu"
-version = "0.48.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
-
-[[package]]
-name = "windows_x86_64_gnullvm"
-version = "0.48.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
-
-[[package]]
-name = "windows_x86_64_msvc"
-version = "0.48.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
diff --git a/gulagcleaner_python/rust/lib.rs b/gulagcleaner_python/rust/lib.rs
index 9afe8fd..6df40c0 100644
--- a/gulagcleaner_python/rust/lib.rs
+++ b/gulagcleaner_python/rust/lib.rs
@@ -1,9 +1,9 @@
 use pyo3::prelude::*;
 
 #[pyfunction]
-pub fn clean_pdf(data: Vec<u8>,force_naive: u8) -> PyResult<(Vec<u8>,u8)> {
-    let (clean_pdf,method_code) = gulagcleaner_rs::clean_pdf(data, force_naive);
-    Ok((clean_pdf,method_code))
+pub fn clean_pdf(data: Vec<u8>, force_naive: bool) -> PyResult<(Vec<u8>, u8)> {
+    let (clean_pdf, method_code) = gulagcleaner_rs::clean_pdf(data, force_naive);
+    Ok((clean_pdf, method_code))
 }
 
 #[pymodule]
@@ -11,4 +11,3 @@ fn _lib(_py: Python, m: &PyModule) -> PyResult<()> {
     m.add_function(wrap_pyfunction!(clean_pdf, m)?)?;
     Ok(())
 }
-
diff --git a/gulagcleaner_rs/.gitignore b/gulagcleaner_rs/.gitignore
new file mode 100644
index 0000000..a41d886
--- /dev/null
+++ b/gulagcleaner_rs/.gitignore
@@ -0,0 +1,2 @@
+Cargo.lock
+example_docs/out
\ No newline at end of file
diff --git a/gulagcleaner_rs/example_docs/studocu-example.pdf b/gulagcleaner_rs/example_docs/studocu-example.pdf
new file mode 100644
index 0000000..142a89c
Binary files /dev/null and b/gulagcleaner_rs/example_docs/studocu-example.pdf differ
diff --git a/gulagcleaner_rs/example_docs/wuolah-free-example.pdf b/gulagcleaner_rs/example_docs/wuolah-free-example.pdf
new file mode 100644
index 0000000..345e6e0
Binary files /dev/null and b/gulagcleaner_rs/example_docs/wuolah-free-example.pdf differ
diff --git a/gulagcleaner_rs/src/clean.rs b/gulagcleaner_rs/src/clean.rs
new file mode 100644
index 0000000..bcb9062
--- /dev/null
+++ b/gulagcleaner_rs/src/clean.rs
@@ -0,0 +1,105 @@
+use crate::models::method::Method;
+
+use lopdf::Document;
+use std::collections::HashSet;
+
+/// Trait implemented by the different PDF methods
+pub trait Cleaner {
+    fn clean(&mut self, doc: &mut Document) -> (Vec<u32>, u8);
+}
+
+/// Cleans a PDF document by modifying its pages and removing unnecessary content.
+///
+/// # Arguments
+///
+/// * `data` - The PDF document data as a vector of bytes.
+/// * `force_naive` - A boolean indicating whether to use the naive cleaning method.
+///
+/// # Returns
+///
+/// A tuple containing the cleaned PDF document data as a vector of bytes and a method code.
+///
+/// The method code indicates the cleaning method used: 0 for "Wuolah", 1 for "StuDocu", and 2 for "Naive".
+pub fn clean_pdf(data: Vec<u8>, force_naive: bool) -> (Vec<u8>, u8) {
+    //Load the PDF into a Document
+    let mut doc = Document::load_mem(&data).unwrap();
+
+    //We first need to determine what method we're using, either "Wuolah", "StuDocu" or "Wuolah naive".
+    // We keep it like this to allow for future methods if needed.
+
+    //Each method should mark pages for deletion in to_delete and modify the contents of the pages.
+
+    let (to_delete, method_code) = match_method(&doc, force_naive).clean(&mut doc);
+
+    //Delete the pages that we've marked for deletion.
+    for (offset, page) in to_delete.into_iter().enumerate() {
+        doc.delete_pages(&[page - offset as u32]);
+    }
+    //Save the document.
+    let mut return_stream = Vec::new();
+    doc.save_to(&mut return_stream).unwrap();
+
+    // Should we still return the method_code now that we are going multi-language? I will leave it not returned for now.
+    //return_stream.push(method_code);
+    (return_stream, method_code)
+    //doc.save_to("test.pdf").unwrap();
+}
+
+/// Creates a new `Method` instance based on the provided `Document` and `force_naive` flag.
+///
+/// # Arguments
+///
+/// * `doc` - A reference to the `Document` object.
+/// * `force_naive` - A boolean flag indicating whether to force the use of the naive method.
+///
+/// # Returns
+///
+/// A `Method` instance representing the chosen method based on the provided `Document` and `force_naive` flag.
+
+fn match_method(doc: &Document, force_naive: bool) -> Method {
+    //0 for auto, 1 for wuolah, 2 for studocu 3 for wuolah naive
+    if force_naive {
+        return Method::Naive;
+    }
+
+    let pages = doc.get_pages();
+    let content_list: Vec<Vec<(u32, u16)>> = pages
+        .iter()
+        .map(|x| doc.get_page_contents(*x.1))
+        .filter(|x| x.len() > 1)
+        .collect();
+
+    let to_delete: Vec<u32> = pages
+        .iter()
+        .filter(|x| {
+            let contents = doc.get_page_contents(*x.1);
+
+            contents.len() == 1
+        })
+        .map(|x| *x.0)
+        .collect();
+
+    if content_list
+        .iter()
+        .map(|x| x.len())
+        .filter(|x| *x == 3)
+        .collect::<Vec<_>>()
+        .len()
+        > 1
+    {
+        return Method::StuDocu(content_list);
+    }
+
+    if content_list.len() > 1
+        && content_list[0]
+            .iter()
+            .collect::<HashSet<_>>()
+            .intersection(&content_list[1].iter().collect::<HashSet<_>>())
+            .collect::<Vec<_>>()
+            .len()
+            > 1
+    {
+        return Method::Wuolah(content_list, to_delete);
+    }
+    Method::Naive
+}
diff --git a/gulagcleaner_rs/src/lib.rs b/gulagcleaner_rs/src/lib.rs
index 929d530..11d02cb 100644
--- a/gulagcleaner_rs/src/lib.rs
+++ b/gulagcleaner_rs/src/lib.rs
@@ -1,345 +1,39 @@
-//WARNING: I need to add comments to all of the files in this folder. I will do it ASAP. I'm sorry for the inconvenience.
+/*!
 
+ [![github]](https://github.com/YM162/gulagcleaner)
 
-pub mod method;
+  [github]: https://img.shields.io/badge/github-8da0cb?style=for-the-badge&labelColor=555555&logo=github
 
-pub mod page_type;
+ # GulagCleaner crate in Rust
+ Gulag Cleaner is a tool designed to remove advertisements from PDFs, making it easier to read and navigate documents without being disrupted by unwanted ads.
 
-use lopdf::{Dictionary, Document, Object, ObjectId};
+ # Examples
 
-use std::{collections::HashSet, error::Error};
+    ```rust
+    use gulagcleaner_rs::clean::clean_pdf;
 
-
-
-pub fn clean_pdf(data: Vec<u8>,force_naive: u8) -> (Vec<u8>,u8) {
-
-    //Load the PDF into a Document
-    let mut doc = Document::load_mem(&data).unwrap();
-    let pages = doc.get_pages();
-
-    //We first need to determine what method we're using, either "Wuolah", "StuDocu" or "Wuolah naive". We keep it like this to allow for future methods if needed.
-
-    let method = method::Method::new(&doc, force_naive);
-
-    //Each method should mark pages for deletion in to_delete and modify the contents of the pages.
-    
-    let (to_delete,method_code) = match method {
-        method::Method::Wuolah(content_list, to_delete) => {
-            println!("Using Wuolah method");
-            let new_contents: Vec<Vec<(u32, u16)>> = content_list
-                .iter()
-                .enumerate()
-                .map(|(i, x)| {
-                    let pares = if x == content_list.last().unwrap() {
-                        find_iobj_pairs(x, &content_list[i - 1])
-                    } else {
-                        let check_if_00 = find_iobj_pairs(x, &content_list[i + 1]);
-                        if check_if_00 != (0,0) {
-                            check_if_00
-                        } else {
-                            find_iobj_pairs(x, &content_list[i - 1])
-                        }
-                    };
-
-                    x[(pares.0) - 2..=(pares.1) + 3].to_vec()
-                })
-                .collect();
-
-            let vector: Vec<(&u32, &(u32, u16))> = pages
-                .iter()
-                .filter(|x| doc.get_page_contents(*x.1).len() > 1)
-                .collect();
-            for (i, page) in vector.iter().enumerate() {
-                let mutable_page = doc.get_object_mut(*page.1).unwrap().as_dict_mut().unwrap();
-                let contents_objects: Vec<Object> = new_contents[i]
-                    .iter()
-                    .map(|x| Object::Reference(*x))
-                    .collect();
-
-                mutable_page.set(*b"Contents", lopdf::Object::Array(contents_objects));
-
-                mutable_page.set("Annots", Object::Array(vec![]));
-                let mediabox = mutable_page.get(b"MediaBox").unwrap().as_array().unwrap();
-                
-                let height_offset = match mediabox[1].as_f32() {
-                    Ok(h) => h,
-                    _ => mediabox[1].as_i64().unwrap() as f32,
-                };
-                let width_offset = match mediabox[0].as_f32() {
-                    Ok(h) => h,
-                    _ => mediabox[0].as_i64().unwrap() as f32,
-                };
-
-                let height = match mediabox[3].as_f32() {
-                    Ok(h) => h,
-                    _ => mediabox[3].as_i64().unwrap() as f32,
-                };
-                let width = match mediabox[2].as_f32() {
-                    Ok(h) => h,
-                    _ => mediabox[2].as_i64().unwrap() as f32,
-                };
-
-                for _box in ["MediaBox", "ArtBox", "TrimBox", "CropBox", "BleedBox"] {
-                    mutable_page.set(
-                        _box,
-                        Object::Array(vec![
-                            Object::Real(0.0),
-                            Object::Real(0.0),
-                            Object::Real(width - width_offset),
-                            Object::Real(height - height_offset),
-                        ]),
-                    );
-                };
-            }
-
-
-            (to_delete,0)
-        }
-
-        method::Method::StuDocu(content_list) => {
-            println!("Using StuDocu method");
-            let new_contents: Vec<Vec<(u32, u16)>> = content_list
-                .iter()
-                .skip(1)
-                .map(|x| {
-                    vec![x[1]]
-                })
-                .collect();
-
-            let vector: Vec<(&u32, &(u32, u16))> = pages
-                .iter()
-                .filter(|x| *x.0 != 1)
-                .collect();
-            for (i, page) in vector.iter().enumerate() {
-                let mutable_page = doc.get_object_mut(*page.1).unwrap().as_dict_mut().unwrap();
-                let contents_objects: Vec<Object> = new_contents[i]
-                    .iter()
-                    .map(|x| Object::Reference(*x))
-                    .collect();
-
-                mutable_page.set(*b"Contents", lopdf::Object::Array(contents_objects));
-
-                mutable_page.set("Annots", Object::Array(vec![]));
-            }
-            (vec![1],1)
-        }
-
-        method::Method::Naive => {
-            println!("Using naive method");
-            let mut to_delete = Vec::new();
-
-            for page in &pages {
-                let page_type = page_type::PageType::get_page_type(&doc, page.1).unwrap_or_default();
-                let mutable_page = doc.get_object_mut(*page.1).unwrap().as_dict_mut().unwrap();
-
-                let mediabox = mutable_page.get(b"MediaBox").unwrap().as_array().unwrap();
-                let height_offset = match mediabox[1].as_f32() {
-                    Ok(h) => h,
-                    _ => mediabox[1].as_i64().unwrap() as f32,
-                };
-                let width_offset = match mediabox[0].as_f32() {
-                    Ok(h) => h,
-                    _ => mediabox[0].as_i64().unwrap() as f32,
-                };
-
-                let height = match mediabox[3].as_f32() {
-                    Ok(h) => h,
-                    _ => mediabox[3].as_i64().unwrap() as f32,
-                };
-                let width = match mediabox[2].as_f32() {
-                    Ok(h) => h,
-                    _ => mediabox[2].as_i64().unwrap() as f32,
-                };
-                
-                match page_type {
-                    page_type::PageType::FullPageAds => to_delete.push(*page.0),
-                    page_type::PageType::Idk => to_delete.push(*page.0),
-                    page_type::PageType::BannerAds => {
-                        //1.141
-                        let scale = 1.124;
-                        for _box in ["MediaBox", "ArtBox", "TrimBox", "CropBox", "BleedBox"] {
-                            mutable_page.set(
-                                _box,
-                                Object::Array(vec![
-                                    Object::Real(0.164 * (width-width_offset) + width_offset*scale),
-                                    Object::Real(0.031 * (height-height_offset) + height_offset*scale),
-                                    Object::Real(0.978 * (width-width_offset) * scale + width_offset*scale),
-                                    Object::Real(0.865 * (height-height_offset) * scale + height_offset*scale),
-                                ]),
-                            );
-                        };
-
-                        let mut contents = doc.get_page_content(*page.1).unwrap();
-                        let mut new_contents = Vec::new();
-                        let c_prepend = "q\n1.124 0 0 1.124 0 0 cm\n".as_bytes();
-                        let c_append = "Q".as_bytes();
-
-                        new_contents.extend_from_slice(c_prepend);
-                        new_contents.append(&mut contents);
-                        new_contents.extend_from_slice(c_append);
-
-                        doc.change_page_content(*page.1, new_contents).unwrap()
-                    }
-                    page_type::PageType::Watermark => {
-                        for _box in ["MediaBox", "ArtBox", "TrimBox", "CropBox", "BleedBox"] {
-                            mutable_page.set(
-                                _box,
-                                Object::Array(vec![
-                                    Object::Real(0.015 * (width-width_offset) + width_offset),
-                                    Object::Real(0.05 * (height-height_offset) + height_offset),
-                                    Object::Real(0.95 * (width-width_offset) + width_offset),
-                                    Object::Real(0.98 * (height-height_offset) + height_offset),
-                                ]),
-                            );
-                        };
-                    }
-                }
-            }
-
-            for page in &pages {
-                // remove the logo
-                let _ = remove_logo(&mut doc, page.1);
-
-                
-                // remove the annotations
-                let mutable_page = doc.get_object_mut(*page.1).unwrap().as_dict_mut().unwrap();
-                mutable_page.set("Annots", Object::Array(vec![]));
-                
-            }
-
-            (to_delete,2)
-        }
-    };
-
-    //Delete the pages that we've marked for deletion.
-    for (offset, page) in to_delete.into_iter().enumerate() {
-        doc.delete_pages(&[page - offset as u32]);
+    fn main(){
+        let data = std::fs::read("example_docs/wuolah-free-example.pdf").unwrap();
+        let (clean_pdf, _) = clean_pdf(data, false);
+        //Stores the clean pdf in the out directory
+        std::fs::write("example_docs/out/wuolah_clean.pdf", clean_pdf).unwrap();
     }
-    //Save the document.
-    let mut return_stream = Vec::new();
-    doc.save_to(&mut return_stream).unwrap();
+    ```
+*/
+/// Main method execution
+pub mod clean;
 
-    // Should we still return the method_code now that we are going multi-language? I will leave it not returned for now.
-    //return_stream.push(method_code);
-    (return_stream,method_code)
-    //doc.save_to("test.pdf").unwrap();
-}
-
-fn find_iobj_pairs(first_page: &[(u32, u16)], second_page: &[(u32, u16)]) -> (usize, usize) {
-    let unique_first_page: HashSet<&(u32, u16)> = first_page.iter().collect();
-    let unique_second_page: HashSet<&(u32, u16)> = second_page.iter().collect();
+/// Main method rexport
+pub use clean::clean_pdf;
 
-    let c: Vec<&&(u32, u16)> = unique_first_page
-        .intersection(&unique_second_page)
-        .collect();
-    if c.len() != 2 {
-        return (0, 0);
-    }
-    let first_index = first_page.iter().position(|&r| r == **c[0]).unwrap();
-    let second_index = first_page.iter().position(|&r| r == **c[1]).unwrap();
+/// Modeling the different pdf sources and types
+pub mod models {
+    /// Represents the different methods used in the Gulag Cleaner application.
+    pub mod method;
 
-    if first_index < second_index {
-        (first_index, second_index)
-    } else {
-        (second_index, first_index)
-    }
-}
-
-fn get_xobjs<'a>(doc: &'a Document, page: &ObjectId) -> Result<&'a Dictionary, Box<dyn Error>> {
-    
-    let resource = doc.get_page_resources(*page);
-    let resource_dict;
-    if resource.1.is_empty() {
-        resource_dict = resource.0.unwrap();
-    } else {
-        resource_dict = doc.get_object(resource.1[0])?.as_dict()?;
-    }
-    
-    let xobjs = resource_dict
-        .get(b"XObject")?
-        .as_dict()?;
-    Ok(xobjs)
-}
-
-fn get_objdict<'a>(
-    doc: &'a Document,
-    obj: (&Vec<u8>, &Object),
-) -> Result<&'a Dictionary, Box<dyn Error>> {
-    let objdict = &doc
-        .get_object(obj.1.as_reference().unwrap())?
-        .as_stream()?
-        .dict;
-
-    Ok(objdict)
-}
-
-fn get_images(doc: &Document, xobjs: &Dictionary) -> Result<Vec<(i64, i64)>, Box<dyn Error>> {
-    let mut images = Vec::new();
-
-    for obj in xobjs {
-        let objectdict = get_objdict(doc, obj)?;
-
-        let subtype = objectdict.get(b"Subtype").unwrap().as_name().unwrap();
-        let sub_s = String::from_utf8_lossy(subtype);
-        
-        if sub_s.starts_with("Image") {
-            images.push((
-                objectdict.get(b"Height").unwrap().as_i64().unwrap(),
-                objectdict.get(b"Width").unwrap().as_i64().unwrap(),
-            ));
-        }
-    }
-    
-    Ok(images)
-}
-
-fn remove_logo(doc: &mut Document, page: &ObjectId) -> Result<(), Box<dyn Error>> {
-    let xobjs = get_xobjs(doc, page)?.clone();
-    let images = get_images(doc, &xobjs)?;
-    
-    let has_logo = !page_type::LOGO_DIMS
-        .iter()
-        .collect::<HashSet<_>>()
-        .intersection(&images.iter().collect::<HashSet<_>>())
-        .collect::<Vec<_>>()
-        .is_empty();
-
-    if has_logo {
-        for obj in &xobjs {
-            let objectdict = get_objdict(doc, obj)?;
-            
-            let subtype = objectdict.get(b"Subtype")?.as_name()?;
-            
-            let sub_s = String::from_utf8_lossy(subtype);
-            if sub_s.starts_with("Image")
-                && page_type::LOGO_DIMS.contains(&(
-                    objectdict.get(b"Height")?.as_i64()?,
-                    objectdict.get(b"Width")?.as_i64()?,
-                ))
-            {
-                let mutable_page = &mut doc
-                    .get_object_mut(obj.1.as_reference()?)?
-                    .as_stream_mut()?
-                    .dict;
-                mutable_page.set(*b"Height", 0);
-            }
-            {
-        }
-        }
-    }
-
-    Ok(())
+    /// Represents the different page types used in the Gulag Cleaner application.
+    pub mod page_type;
 }
 
 #[cfg(test)]
-mod tests {
-    use crate::clean_pdf;
-    #[test]
-    fn test_pdf() {
-        //Load some pdf bytes and clean it
-        let data = std::fs::read("../test.pdf").unwrap();
-        let (clean_pdf,_) = clean_pdf(data,0);
-        //Print the length of the pdf
-        std::fs::write("../test_clean.pdf", clean_pdf).unwrap();
-    }
-}
\ No newline at end of file
+pub mod tests;
diff --git a/gulagcleaner_rs/src/method.rs b/gulagcleaner_rs/src/method.rs
deleted file mode 100644
index d5b7b93..0000000
--- a/gulagcleaner_rs/src/method.rs
+++ /dev/null
@@ -1,63 +0,0 @@
-//WARNING: I need to add comments to all of the files in this folder. I will do it ASAP. I'm sorry for the inconvenience.
-
-use std::collections::HashSet;
-
-use lopdf::Document;
-
-pub enum Method {
-    Wuolah(Vec<Vec<(u32, u16)>>, Vec<u32>),
-    StuDocu(Vec<Vec<(u32, u16)>>),
-    Naive
-}
-
-impl Method {
-    pub fn new(doc: &Document, force_naive: u8) -> Self {
-        //0 for auto, 1 for wuolah, 2 for studocu 3 for wuolah naive
-        if force_naive == 1 {
-            return Self::Naive
-        }
-        let pages = doc.get_pages();
-        let content_list: Vec<Vec<(u32, u16)>> = pages
-            .iter()
-            .map(|x| doc.get_page_contents(*x.1))
-            .filter(|x| x.len() > 1)
-            .collect();
-        let to_delete: Vec<u32> = pages
-            .iter()
-            .filter(|x| {
-                let contents = doc.get_page_contents(*x.1);
-                
-                if contents.len() == 1 {
-                    return true;
-                } else {
-                    return false;
-                }
-            })
-            .map(|x| *x.0)
-            .collect();
-        
-        if content_list
-            .iter()
-            .map(|x| x.len())
-            .filter(|x| *x==3)
-            .collect::<Vec<_>>()
-            .len() 
-            > 1 
-            {
-                return Self::StuDocu(content_list)
-            }
-
-        if content_list.len() > 1
-            && content_list[0]
-                .iter()
-                .collect::<HashSet<_>>()
-                .intersection(&content_list[1].iter().collect::<HashSet<_>>())
-                .collect::<Vec<_>>()
-                .len()
-                > 1
-                {
-                    return Self::Wuolah(content_list, to_delete);
-                }
-        Self::Naive
-    }
-}
\ No newline at end of file
diff --git a/gulagcleaner_rs/src/models/method.rs b/gulagcleaner_rs/src/models/method.rs
new file mode 100644
index 0000000..aad56eb
--- /dev/null
+++ b/gulagcleaner_rs/src/models/method.rs
@@ -0,0 +1,321 @@
+use std::{collections::HashSet, error::Error};
+
+use lopdf::{Dictionary, Document, Object, ObjectId};
+
+use crate::{clean::Cleaner, models::page_type};
+
+pub enum Method {
+    /// The Wuolah method, which takes a vector of vectors of tuples containing unsigned integers and unsigned shorts,
+    /// and a vector of unsigned integers as parameters.
+    Wuolah(Vec<Vec<(u32, u16)>>, Vec<u32>),
+    /// The StuDocu method, which takes a vector of vectors of tuples containing unsigned integers and unsigned shorts
+    /// as a parameter.
+    StuDocu(Vec<Vec<(u32, u16)>>),
+    /// The Naive method, which does not take any parameters.
+    Naive,
+}
+
+/// Implements the `Cleaner` trait for the `Method` enum.
+/// This method cleans the document based on the selected method.
+/// It modifies the contents and properties of the document's pages.
+/// Returns a tuple containing the pages to delete and a status code.
+impl Cleaner for Method {
+    fn clean(&mut self, doc: &mut Document) -> (Vec<u32>, u8) {
+        match self {
+            Method::Wuolah(content_list, to_delete) => {
+                let new_contents: Vec<Vec<(u32, u16)>> = content_list
+                    .iter()
+                    .enumerate()
+                    .map(|(i, x)| {
+                        let pares = if x == content_list.last().unwrap() {
+                            find_iobj_pairs(x, &content_list[i - 1])
+                        } else {
+                            let check_if_00 = find_iobj_pairs(x, &content_list[i + 1]);
+                            if check_if_00 != (0, 0) {
+                                check_if_00
+                            } else {
+                                find_iobj_pairs(x, &content_list[i - 1])
+                            }
+                        };
+
+                        x[(pares.0) - 2..=(pares.1) + 3].to_vec()
+                    })
+                    .collect();
+
+                let pages = doc.get_pages();
+
+                let vector: Vec<(&u32, &(u32, u16))> = pages
+                    .iter()
+                    .filter(|x| doc.get_page_contents(*x.1).len() > 1)
+                    .collect();
+                for (i, page) in vector.iter().enumerate() {
+                    let mutable_page = doc.get_object_mut(*page.1).unwrap().as_dict_mut().unwrap();
+                    let contents_objects: Vec<Object> = new_contents[i]
+                        .iter()
+                        .map(|x| Object::Reference(*x))
+                        .collect();
+
+                    mutable_page.set(*b"Contents", lopdf::Object::Array(contents_objects));
+
+                    mutable_page.set("Annots", Object::Array(vec![]));
+                    let mediabox = mutable_page.get(b"MediaBox").unwrap().as_array().unwrap();
+
+                    let height_offset = match mediabox[1].as_f32() {
+                        Ok(h) => h,
+                        _ => mediabox[1].as_i64().unwrap() as f32,
+                    };
+                    let width_offset = match mediabox[0].as_f32() {
+                        Ok(h) => h,
+                        _ => mediabox[0].as_i64().unwrap() as f32,
+                    };
+
+                    let height = match mediabox[3].as_f32() {
+                        Ok(h) => h,
+                        _ => mediabox[3].as_i64().unwrap() as f32,
+                    };
+                    let width = match mediabox[2].as_f32() {
+                        Ok(h) => h,
+                        _ => mediabox[2].as_i64().unwrap() as f32,
+                    };
+
+                    for _box in ["MediaBox", "ArtBox", "TrimBox", "CropBox", "BleedBox"] {
+                        mutable_page.set(
+                            _box,
+                            Object::Array(vec![
+                                Object::Real(0.0),
+                                Object::Real(0.0),
+                                Object::Real(width - width_offset),
+                                Object::Real(height - height_offset),
+                            ]),
+                        );
+                    }
+                }
+
+                (to_delete.to_vec(), 0)
+            }
+            Method::StuDocu(content_list) => {
+                let new_contents: Vec<Vec<(u32, u16)>> =
+                    content_list.iter().skip(1).map(|x| vec![x[1]]).collect();
+                let pages = doc.get_pages();
+                let vector: Vec<(&u32, &(u32, u16))> = pages.iter().filter(|x| *x.0 != 1).collect();
+                for (i, page) in vector.iter().enumerate() {
+                    let mutable_page = doc.get_object_mut(*page.1).unwrap().as_dict_mut().unwrap();
+                    let contents_objects: Vec<Object> = new_contents[i]
+                        .iter()
+                        .map(|x| Object::Reference(*x))
+                        .collect();
+
+                    mutable_page.set(*b"Contents", lopdf::Object::Array(contents_objects));
+
+                    mutable_page.set("Annots", Object::Array(vec![]));
+                }
+                (vec![1], 1)
+            }
+
+            Method::Naive => {
+                println!("Using naive method");
+                let mut to_delete = Vec::new();
+                let pages = doc.get_pages();
+
+                for page in &pages {
+                    let page_type =
+                        page_type::PageType::get_page_type(doc, page.1).unwrap_or_default();
+                    let mutable_page = doc.get_object_mut(*page.1).unwrap().as_dict_mut().unwrap();
+
+                    let mediabox = mutable_page.get(b"MediaBox").unwrap().as_array().unwrap();
+                    let height_offset = match mediabox[1].as_f32() {
+                        Ok(h) => h,
+                        _ => mediabox[1].as_i64().unwrap() as f32,
+                    };
+                    let width_offset = match mediabox[0].as_f32() {
+                        Ok(h) => h,
+                        _ => mediabox[0].as_i64().unwrap() as f32,
+                    };
+
+                    let height = match mediabox[3].as_f32() {
+                        Ok(h) => h,
+                        _ => mediabox[3].as_i64().unwrap() as f32,
+                    };
+                    let width = match mediabox[2].as_f32() {
+                        Ok(h) => h,
+                        _ => mediabox[2].as_i64().unwrap() as f32,
+                    };
+
+                    match page_type {
+                        page_type::PageType::FullPageAds => to_delete.push(*page.0),
+                        page_type::PageType::Idk => to_delete.push(*page.0),
+                        page_type::PageType::BannerAds => {
+                            //1.141
+                            let scale = 1.124;
+                            for _box in ["MediaBox", "ArtBox", "TrimBox", "CropBox", "BleedBox"] {
+                                mutable_page.set(
+                                    _box,
+                                    Object::Array(vec![
+                                        Object::Real(
+                                            0.164 * (width - width_offset) + width_offset * scale,
+                                        ),
+                                        Object::Real(
+                                            0.031 * (height - height_offset)
+                                                + height_offset * scale,
+                                        ),
+                                        Object::Real(
+                                            0.978 * (width - width_offset) * scale
+                                                + width_offset * scale,
+                                        ),
+                                        Object::Real(
+                                            0.865 * (height - height_offset) * scale
+                                                + height_offset * scale,
+                                        ),
+                                    ]),
+                                );
+                            }
+
+                            let mut contents = doc.get_page_content(*page.1).unwrap();
+                            let mut new_contents = Vec::new();
+                            let c_prepend = "q\n1.124 0 0 1.124 0 0 cm\n".as_bytes();
+                            let c_append = "Q".as_bytes();
+
+                            new_contents.extend_from_slice(c_prepend);
+                            new_contents.append(&mut contents);
+                            new_contents.extend_from_slice(c_append);
+
+                            doc.change_page_content(*page.1, new_contents).unwrap()
+                        }
+                        page_type::PageType::Watermark => {
+                            for _box in ["MediaBox", "ArtBox", "TrimBox", "CropBox", "BleedBox"] {
+                                mutable_page.set(
+                                    _box,
+                                    Object::Array(vec![
+                                        Object::Real(0.015 * (width - width_offset) + width_offset),
+                                        Object::Real(
+                                            0.05 * (height - height_offset) + height_offset,
+                                        ),
+                                        Object::Real(0.95 * (width - width_offset) + width_offset),
+                                        Object::Real(
+                                            0.98 * (height - height_offset) + height_offset,
+                                        ),
+                                    ]),
+                                );
+                            }
+                        }
+                    }
+                }
+
+                for page in &pages {
+                    // remove the logo
+                    let _ = remove_logo(doc, page.1);
+
+                    // remove the annotations
+                    let mutable_page = doc.get_object_mut(*page.1).unwrap().as_dict_mut().unwrap();
+                    mutable_page.set("Annots", Object::Array(vec![]));
+                }
+
+                (to_delete, 2)
+            }
+        }
+    }
+}
+
+pub fn find_iobj_pairs(first_page: &[(u32, u16)], second_page: &[(u32, u16)]) -> (usize, usize) {
+    let unique_first_page: HashSet<&(u32, u16)> = first_page.iter().collect();
+    let unique_second_page: HashSet<&(u32, u16)> = second_page.iter().collect();
+
+    let c: Vec<&&(u32, u16)> = unique_first_page
+        .intersection(&unique_second_page)
+        .collect();
+    if c.len() != 2 {
+        return (0, 0);
+    }
+    let first_index = first_page.iter().position(|&r| r == **c[0]).unwrap();
+    let second_index = first_page.iter().position(|&r| r == **c[1]).unwrap();
+
+    if first_index < second_index {
+        (first_index, second_index)
+    } else {
+        (second_index, first_index)
+    }
+}
+
+pub fn remove_logo(doc: &mut Document, page: &ObjectId) -> Result<(), Box<dyn Error>> {
+    let xobjs = get_xobjs(doc, page)?.clone();
+    let images = get_images(doc, &xobjs)?;
+
+    // let has_logo = !page_type::LOGO_DIMS
+    //     .iter()
+    //     .collect::<HashSet<_>>()
+    //     .intersection(&images.iter().collect::<HashSet<_>>())
+    //     .collect::<Vec<_>>()
+    //     .is_empty();
+
+    let has_logo = images
+        .iter()
+        .any(|image| page_type::LOGO_DIMS.contains(image));
+
+    if !has_logo {
+        return Ok(());
+    }
+    for obj in &xobjs {
+        let objectdict = get_objdict(doc, obj)?;
+
+        let subtype = objectdict.get(b"Subtype")?.as_name()?;
+
+        let sub_s = String::from_utf8_lossy(subtype);
+        if sub_s.starts_with("Image")
+            && page_type::LOGO_DIMS.contains(&(
+                objectdict.get(b"Height")?.as_i64()?,
+                objectdict.get(b"Width")?.as_i64()?,
+            ))
+        {
+            let mutable_page = &mut doc
+                .get_object_mut(obj.1.as_reference()?)?
+                .as_stream_mut()?
+                .dict;
+            mutable_page.set(*b"Height", 0);
+        }
+    }
+    Ok(())
+}
+
+fn get_objdict<'a>(
+    doc: &'a Document,
+    obj: (&Vec<u8>, &Object),
+) -> Result<&'a Dictionary, Box<dyn Error>> {
+    let objdict = &doc
+        .get_object(obj.1.as_reference().unwrap())?
+        .as_stream()?
+        .dict;
+
+    Ok(objdict)
+}
+
+pub fn get_xobjs<'a>(doc: &'a Document, page: &ObjectId) -> Result<&'a Dictionary, Box<dyn Error>> {
+    let resource = doc.get_page_resources(*page);
+    let resource_dict: &Dictionary = if resource.1.is_empty() {
+        resource.0.unwrap()
+    } else {
+        doc.get_object(resource.1[0])?.as_dict()?
+    };
+
+    let xobjs = resource_dict.get(b"XObject")?.as_dict()?;
+    Ok(xobjs)
+}
+
+pub fn get_images(doc: &Document, xobjs: &Dictionary) -> Result<Vec<(i64, i64)>, Box<dyn Error>> {
+    let mut images = Vec::new();
+
+    for obj in xobjs {
+        let objectdict = get_objdict(doc, obj)?;
+
+        let subtype = objectdict.get(b"Subtype").unwrap().as_name().unwrap();
+        let sub_s = String::from_utf8_lossy(subtype);
+
+        if sub_s.starts_with("Image") {
+            images.push((
+                objectdict.get(b"Height").unwrap().as_i64().unwrap(),
+                objectdict.get(b"Width").unwrap().as_i64().unwrap(),
+            ));
+        }
+    }
+
+    Ok(images)
+}
diff --git a/gulagcleaner_rs/src/page_type.rs b/gulagcleaner_rs/src/models/page_type.rs
similarity index 69%
rename from gulagcleaner_rs/src/page_type.rs
rename to gulagcleaner_rs/src/models/page_type.rs
index 485dd46..2517bbb 100644
--- a/gulagcleaner_rs/src/page_type.rs
+++ b/gulagcleaner_rs/src/models/page_type.rs
@@ -1,12 +1,11 @@
-//WARNING: I need to add comments to all of the files in this folder. I will do it ASAP. I'm sorry for the inconvenience.
-
-use std::{error::Error, collections::HashSet};
+use std::{collections::HashSet, error::Error};
 
 use lopdf::{Document, ObjectId};
 
-use crate::{get_xobjs, get_images};
+use super::method::{get_images, get_xobjs};
 
 #[derive(Default)]
+/// Represents the different methods used in the Gulag Cleaner application.
 pub enum PageType {
     BannerAds,
     FullPageAds,
@@ -24,7 +23,7 @@ const HORIZONTAL_BANNER_DIMS: [(i64, i64); 7] = [
     (249, 1414),
     (217, 1240),
     (147, 1757),
-    (221, 1240)
+    (221, 1240),
 ];
 const VERTICAL_BANNER_DIMS: [(i64, i64); 8] = [
     (1753, 170),
@@ -34,7 +33,7 @@ const VERTICAL_BANNER_DIMS: [(i64, i64); 8] = [
     (1751, 171),
     (1537, 147),
     (1093, 217),
-    (1534, 150)
+    (1534, 150),
 ];
 const FULL_PAGE_DIMS: [(i64, i64); 7] = [
     (842, 595),
@@ -43,14 +42,28 @@ const FULL_PAGE_DIMS: [(i64, i64); 7] = [
     (1733, 1219),
     (3508, 2480),
     (2339, 1653),
-    (1785,2526),
+    (1785, 2526),
 ];
 
 impl PageType {
+    /// Get the type of a page based on its content.
+    ///
+    /// This function takes a document and a page ID as input and returns the type of the page.
+    /// The page type is determined by analyzing the images present in the page.
+    /// It checks for the presence of specific image dimensions to identify different types of pages,
+    /// such as banner ads, full-page ads, watermarks, or unknown types.
+    ///
+    /// # Arguments
+    ///
+    /// * `doc` - A reference to the document containing the page.
+    /// * `page` - A reference to the ID of the page.
+    ///
+    /// # Returns
+    ///
+    /// A `Result` containing the `PageType` of the page if successful, or a `Box<dyn Error>` if an error occurs.
     pub fn get_page_type(doc: &Document, page: &ObjectId) -> Result<PageType, Box<dyn Error>> {
         let xobjs = get_xobjs(doc, page)?;
         let images = get_images(doc, xobjs)?;
-        println!("Images: {:?}",images);
         let has_logo = !LOGO_DIMS
             .iter()
             .collect::<HashSet<_>>()
@@ -89,4 +102,4 @@ impl PageType {
             Ok(PageType::Idk)
         }
     }
-}
\ No newline at end of file
+}
diff --git a/gulagcleaner_wasm/src/lib.rs b/gulagcleaner_wasm/src/lib.rs
index 6676bca..986e7dc 100644
--- a/gulagcleaner_wasm/src/lib.rs
+++ b/gulagcleaner_wasm/src/lib.rs
@@ -1,7 +1,6 @@
-use wasm_bindgen::prelude::*;
 use gulagcleaner_rs;
-use serde::{Serialize, Deserialize};
-
+use serde::{Deserialize, Serialize};
+use wasm_bindgen::prelude::*;
 
 #[derive(Serialize, Deserialize)]
 pub struct CleaningResult {
@@ -10,8 +9,8 @@ pub struct CleaningResult {
 }
 
 #[wasm_bindgen]
-pub fn clean_pdf(data: Vec<u8>,force_naive: u8) -> Vec<u8> {
-    let (clean_pdf,method_code) = gulagcleaner_rs::clean_pdf(data, force_naive);
+pub fn clean_pdf(data: Vec<u8>, force_naive: bool) -> Vec<u8> {
+    let (clean_pdf, _) = gulagcleaner_rs::clean_pdf(data, force_naive);
     // For some reason, the serde serialization messes up our data, so we just return the raw bytes until we find a fix
     // let example = CleaningResult {
     //     result: clean_pdf,
@@ -19,4 +18,4 @@ pub fn clean_pdf(data: Vec<u8>,force_naive: u8) -> Vec<u8> {
     // };
     // Ok(serde_wasm_bindgen::to_value(&example)?)
     return clean_pdf;
-}
\ No newline at end of file
+}


Test patch:
diff --git a/gulagcleaner_rs/src/tests.rs b/gulagcleaner_rs/src/tests.rs
new file mode 100644
index 0000000..cd223fe
--- /dev/null
+++ b/gulagcleaner_rs/src/tests.rs
@@ -0,0 +1,36 @@
+use crate::clean::clean_pdf;
+use std::fs;
+
+const OUT_PATH: &str = "example_docs/out";
+
+/// Creates out folder if missing so tests won't fail
+fn create_out_folder() {
+    fs::create_dir_all(OUT_PATH).unwrap();
+}
+
+#[test]
+fn test_wuolah() {
+    create_out_folder();
+
+    //Load some pdf bytes and clean it
+    let data = std::fs::read("example_docs/wuolah-free-example.pdf").expect(
+        "Missing Wuolah test PDF, please store one in path `example_docs/wuolah-free-example.pdf",
+    );
+    let (clean_pdf, _) = clean_pdf(data, false);
+
+    //Stores the clean pdf in the out directory
+    std::fs::write(format!("{}/wuolah_clean.pdf", OUT_PATH), clean_pdf).unwrap();
+}
+#[test]
+
+fn test_studocu() {
+    create_out_folder();
+
+    //Stores the clean pdf in the out directory
+    let data = std::fs::read("example_docs/studocu-example.pdf").expect(
+        "Missing Studocu test PDF, please store one in path `example_docs/studocu-example.pdf",
+    );
+    let (clean_pdf, _) = clean_pdf(data, false);
+    //Print the length of the pdf
+    std::fs::write(format!("{}/studocu_clean.pdf", OUT_PATH), clean_pdf).unwrap();
+}