diff --git a/BUILD.bazel b/BUILD.bazel
index 6e35e11..87633a2 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -24,168 +24,27 @@ prefix_dir = "src/"
 
 cc_library(
     name = "thrax",
-    srcs = [
-        prefix_dir + "lib/ast/collection-node.cc",
-        prefix_dir + "lib/ast/fst-node.cc",
-        prefix_dir + "lib/ast/function-node.cc",
-        prefix_dir + "lib/ast/grammar-node.cc",
-        prefix_dir + "lib/ast/identifier-node.cc",
-        prefix_dir + "lib/ast/import-node.cc",
-        prefix_dir + "lib/ast/node.cc",
-        prefix_dir + "lib/ast/return-node.cc",
-        prefix_dir + "lib/ast/rule-node.cc",
-        prefix_dir + "lib/ast/statement-node.cc",
-        prefix_dir + "lib/ast/string-node.cc",
-        prefix_dir + "lib/flags/flags.cc",
-        prefix_dir + "lib/main/compiler-log.cc",
-        prefix_dir + "lib/main/compiler-log64.cc",
-        prefix_dir + "lib/main/compiler-stdarc.cc",
-        prefix_dir + "lib/main/grm-compiler.cc",
-        prefix_dir + "lib/main/lexer.cc",
-        prefix_dir + "lib/main/parser.cc",
-        prefix_dir + "lib/util/getters.cc",
-        prefix_dir + "lib/util/stringcompile.cc",
-        prefix_dir + "lib/util/stringfile.cc",
-        prefix_dir + "lib/util/stringutil.cc",
-        prefix_dir + "lib/util/utils.cc",
-        prefix_dir + "lib/walker/assert-empty.cc",
-        prefix_dir + "lib/walker/assert-equal.cc",
-        prefix_dir + "lib/walker/assert-null.cc",
-        prefix_dir + "lib/walker/cdrewrite.cc",
-        prefix_dir + "lib/walker/closure.cc",
-        prefix_dir + "lib/walker/compose.cc",
-        prefix_dir + "lib/walker/concat.cc",
-        prefix_dir + "lib/walker/determinize.cc",
-        prefix_dir + "lib/walker/difference.cc",
-        prefix_dir + "lib/walker/evaluator.cc",
-        prefix_dir + "lib/walker/expand.cc",
-        prefix_dir + "lib/walker/features.cc",
-        prefix_dir + "lib/walker/identifier-counter.cc",
-        prefix_dir + "lib/walker/invert.cc",
-        prefix_dir + "lib/walker/lenientlycompose.cc",
-        prefix_dir + "lib/walker/loadfst.cc",
-        prefix_dir + "lib/walker/loadfstfromfar.cc",
-        prefix_dir + "lib/walker/minimize.cc",
-        prefix_dir + "lib/walker/mpdtcompose.cc",
-        prefix_dir + "lib/walker/namespace.cc",
-        prefix_dir + "lib/walker/optimize.cc",
-        prefix_dir + "lib/walker/paradigm.cc",
-        prefix_dir + "lib/walker/pdtcompose.cc",
-        prefix_dir + "lib/walker/printer.cc",
-        prefix_dir + "lib/walker/project.cc",
-        prefix_dir + "lib/walker/replace.cc",
-        prefix_dir + "lib/walker/reverse.cc",
-        prefix_dir + "lib/walker/rewrite.cc",
-        prefix_dir + "lib/walker/rmepsilon.cc",
-        prefix_dir + "lib/walker/rmweight.cc",
-        prefix_dir + "lib/walker/stringfile.cc",
-        prefix_dir + "lib/walker/stringfst.cc",
-        prefix_dir + "lib/walker/symbols.cc",
-        prefix_dir + "lib/walker/symboltable.cc",
-        prefix_dir + "lib/walker/union.cc",
-        prefix_dir + "lib/walker/walker.cc",
-    ],
-    hdrs = [
-        prefix_dir + "include/thrax/abstract-grm-manager.h",
-        prefix_dir + "include/thrax/algo/cdrewrite.h",
-        prefix_dir + "include/thrax/algo/checkprops.h",
-        prefix_dir + "include/thrax/algo/concatrange.h",
-        prefix_dir + "include/thrax/algo/cross.h",
-        prefix_dir + "include/thrax/algo/getters.h",
-        prefix_dir + "include/thrax/algo/lenientlycompose.h",
-        prefix_dir + "include/thrax/algo/optimize.h",
-        prefix_dir + "include/thrax/algo/paths.h",
-        prefix_dir + "include/thrax/algo/prefix_tree.h",
-        prefix_dir + "include/thrax/algo/stringcompile.h",
-        prefix_dir + "include/thrax/algo/stringfile.h",
-        prefix_dir + "include/thrax/algo/stringmap.h",
-        prefix_dir + "include/thrax/algo/stringprint.h",
-        prefix_dir + "include/thrax/algo/stringutil.h",
-        prefix_dir + "include/thrax/assert-empty.h",
-        prefix_dir + "include/thrax/assert-equal.h",
-        prefix_dir + "include/thrax/assert-null.h",
-        prefix_dir + "include/thrax/cdrewrite.h",
-        prefix_dir + "include/thrax/closure.h",
-        prefix_dir + "include/thrax/collection-node.h",
-        prefix_dir + "include/thrax/compat/compat.h",
-        prefix_dir + "include/thrax/compat/stlfunctions.h",
-        prefix_dir + "include/thrax/compat/utils.h",
-        prefix_dir + "include/thrax/compose.h",
-        prefix_dir + "include/thrax/compiler.h",
-        prefix_dir + "include/thrax/concat.h",
-        prefix_dir + "include/thrax/datatype.h",
-        prefix_dir + "include/thrax/determinize.h",
-        prefix_dir + "include/thrax/difference.h",
-        prefix_dir + "include/thrax/evaluator.h",
-        prefix_dir + "include/thrax/expand.h",
-        prefix_dir + "include/thrax/features.h",
-        prefix_dir + "include/thrax/fst-node.h",
-        prefix_dir + "include/thrax/function-node.h",
-        prefix_dir + "include/thrax/function.h",
-        prefix_dir + "include/thrax/grammar-node.h",
-        prefix_dir + "include/thrax/grm-compiler.h",
-        prefix_dir + "include/thrax/grm-manager.h",
-        prefix_dir + "include/thrax/identifier-counter.h",
-        prefix_dir + "include/thrax/identifier-node.h",
-        prefix_dir + "include/thrax/import-node.h",
-        prefix_dir + "include/thrax/invert.h",
-        prefix_dir + "include/thrax/lenientlycompose.h",
-        prefix_dir + "include/thrax/lexer.h",
-        prefix_dir + "include/thrax/loadfst.h",
-        prefix_dir + "include/thrax/loadfstfromfar.h",
-        prefix_dir + "include/thrax/make-parens-pair-vector.h",
-        prefix_dir + "include/thrax/minimize.h",
-        prefix_dir + "include/thrax/mpdtcompose.h",
-        prefix_dir + "include/thrax/namespace.h",
-        prefix_dir + "include/thrax/node.h",
-        prefix_dir + "include/thrax/optimize.h",
-        prefix_dir + "include/thrax/paradigm.h",
-        prefix_dir + "include/thrax/pdtcompose.h",
-        prefix_dir + "include/thrax/printer.h",
-        prefix_dir + "include/thrax/project.h",
-        prefix_dir + "include/thrax/replace.h",
-        prefix_dir + "include/thrax/register.h",
-        prefix_dir + "include/thrax/resource-map.h",
-        prefix_dir + "include/thrax/return-node.h",
-        prefix_dir + "include/thrax/reverse.h",
-        prefix_dir + "include/thrax/rewrite.h",
-        prefix_dir + "include/thrax/rmepsilon.h",
-        prefix_dir + "include/thrax/rmweight.h",
-        prefix_dir + "include/thrax/rule-node.h",
-        prefix_dir + "include/thrax/statement-node.h",
-        prefix_dir + "include/thrax/string-node.h",
-        prefix_dir + "include/thrax/stringfile.h",
-        prefix_dir + "include/thrax/stringfst.h",
-        prefix_dir + "include/thrax/symbols.h",
-        prefix_dir + "include/thrax/symboltable.h",
-        prefix_dir + "include/thrax/thrax.h",
-        prefix_dir + "include/thrax/union.h",
-        prefix_dir + "include/thrax/walker.h",
-    ],
+    srcs = glob(
+        ["src/**/*.cc"],
+        exclude = ["**/bin/*"],
+    ),
+    hdrs = glob(["src/include/**/*.h"]),
     includes = [prefix_dir + "include"],
     deps = [
-        "@org_openfst//:far",
-        "@org_openfst//:fst",
-        "@org_openfst//:fstscript",
-        "@org_openfst//:mpdt",
-        "@org_openfst//:pdt",
+        "@openfst//:far",
+        "@openfst//:fst",
+        "@openfst//:fstscript",
+        "@openfst//:mpdt",
+        "@openfst//:pdt",
     ],
 )
 
 cc_library(
-    name = "utildefs",
-    srcs = [prefix_dir + "bin/utildefs.cc"],
-    hdrs = [prefix_dir + "bin/utildefs.h"],
-    deps = [":thrax"],
-)
-
-cc_library(
-    name = "rewrite-tester-utils",
-    srcs = [prefix_dir + "bin/rewrite-tester-utils.cc"],
-    hdrs = [prefix_dir + "bin/rewrite-tester-utils.h"],
+    name = "rewrite-tester-lib",
+    srcs = [prefix_dir + "bin/rewrite-tester.cc"],
+    hdrs = [prefix_dir + "include/thrax/rewrite-tester.h"],
     deps = [
         ":thrax",
-        ":utildefs",
     ],
 )
 
@@ -200,33 +59,14 @@ cc_binary(
     srcs = [prefix_dir + "bin/random-generator.cc"],
     deps = [
         ":thrax",
-        ":utildefs",
     ],
 )
 
 cc_binary(
     name = "rewrite-tester",
-    srcs = [prefix_dir + "bin/rewrite-tester.cc"],
-    deps = [
-        ":rewrite-tester-utils",
-        ":thrax",
-    ],
-)
-
-cc_library(
-    name = "regression_test-lib",
-    testonly = 1,
-    srcs = [prefix_dir + "bin/regression_test.cc"],
-    includes = ["src/bin"],
+    srcs = [prefix_dir + "bin/rewrite-tester-main.cc"],
     deps = [
+        ":rewrite-tester-lib",
         ":thrax",
-        ":utildefs",
-        "@com_google_absl//absl/flags:flag",
-        "@com_google_absl//absl/flags:parse",
-        "@com_google_absl//absl/memory",
-        "@com_google_absl//absl/strings",
-        "@com_google_googletest//:gtest",
-        "@org_openfst//:fst",
-        "@org_openfst//:fstscript_base",
     ],
 )
diff --git a/MODULE.bazel b/MODULE.bazel
new file mode 100644
index 0000000..29f23de
--- /dev/null
+++ b/MODULE.bazel
@@ -0,0 +1,10 @@
+module(
+    name = "thrax",
+    version = "1.3.9",
+    compatibility_level = 0,
+)
+
+bazel_dep(name = "abseil-cpp", version = "20250512.1")
+bazel_dep(name = "googletest", version = "1.17.0")
+bazel_dep(name = "rules_cc", version = "0.1.2")
+bazel_dep(name = "openfst", version = "1.8.4")
diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel
deleted file mode 100644
index ce9128e..0000000
--- a/WORKSPACE.bazel
+++ /dev/null
@@ -1,54 +0,0 @@
-# Copyright 2015-2020 Google LLC.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# Bazel (https://bazel.build/) workspace.
-
-workspace(name = "org_opengrm_thrax")
-
-load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
-
-# -------------------------------------------------------------------------
-# Abseil C++: See
-#    https://github.com/abseil/abseil-cpp
-# -------------------------------------------------------------------------
-
-http_archive(
-    name = "com_google_absl",
-    strip_prefix = "abseil-cpp-master",
-    urls = ["https://github.com/abseil/abseil-cpp/archive/master.zip"],
-)
-
-# -------------------------------------------------------------------------
-# Google testing framework. See
-#    https://github.com/google/googletest
-# -------------------------------------------------------------------------
-
-http_archive(
-    name = "com_google_googletest",
-    strip_prefix = "googletest-main",
-    urls = ["https://github.com/google/googletest/archive/main.zip"],
-)
-
-# -------------------------------------------------------------------------
-# OpenFst: See
-#    http://www.openfst.org/twiki/pub/FST/FstDownload/README
-# -------------------------------------------------------------------------
-openfst_version = "1.8.2"
-
-http_archive(
-    name = "org_openfst",
-    urls = ["https://www.openfst.org/twiki/pub/FST/FstDownload/openfst-%s.tar.gz" % openfst_version],
-    sha256 = "de987bf3624721c5d5ba321af95751898e4f4bb41c8a36e2d64f0627656d8b42",
-    strip_prefix = "openfst-%s" % openfst_version,
-)
diff --git a/src/include/thrax/algo/stringmap.h b/src/include/thrax/algo/stringmap.h
index f2ea7a7..6ee0a7c 100644
--- a/src/include/thrax/algo/stringmap.h
+++ b/src/include/thrax/algo/stringmap.h
@@ -180,7 +180,7 @@ bool StringMapCompile(internal::ColumnStringFile *csf, MutableFst<Arc> *fst,
     const auto log_line_compilation_error = [&csf, &line]() {
       LOG(ERROR) << "StringFileCompile: Ill-formed line " << csf->LineNumber()
                  << " in file " << csf->Filename() << ": `"
-                 << ::fst::StringJoin(line, "\t") << "`";
+                 << ::fst::StrJoin(line, "\t") << "`";
     };
     switch (line.size()) {
       case 1: {
@@ -225,7 +225,7 @@ bool StringMapCompile(const std::vector<std::vector<std::string>> &lines,
   for (const auto &line : lines) {
     const auto log_line_compilation_error = [&line]() {
       LOG(ERROR) << "StringMapCompile: Ill-formed line: `"
-                 << ::fst::StringJoin(line, "\t") << "`";
+                 << ::fst::StrJoin(line, "\t") << "`";
     };
     switch (line.size()) {
       case 1: {
