diff --git a/http/common.hpp b/http/common.hpp
index 01e90b2..8fc9bcf 100644
--- a/http/common.hpp
+++ b/http/common.hpp
@@ -14,73 +14,10 @@
 
 enum class ParamType
 {
-    INT,
-    UINT,
-    DOUBLE,
     STRING,
     PATH,
 
     MAX
 };
 
-struct RoutingParams
-{
-    std::vector<int64_t> intParams;
-    std::vector<uint64_t> uintParams;
-    std::vector<double> doubleParams;
-    std::vector<std::string> stringParams;
-
-    void debugPrint() const
-    {
-        std::cerr << "RoutingParams" << std::endl;
-        for (auto i : intParams)
-        {
-            std::cerr << i << ", ";
-        }
-        std::cerr << std::endl;
-        for (auto i : uintParams)
-        {
-            std::cerr << i << ", ";
-        }
-        std::cerr << std::endl;
-        for (auto i : doubleParams)
-        {
-            std::cerr << i << ", ";
-        }
-        std::cerr << std::endl;
-        for (const std::string& i : stringParams)
-        {
-            std::cerr << i << ", ";
-        }
-        std::cerr << std::endl;
-    }
-
-    template <typename T>
-    T get(unsigned) const;
-};
-
-template <>
-inline int64_t RoutingParams::get<int64_t>(unsigned index) const
-{
-    return intParams[index];
-}
-
-template <>
-inline uint64_t RoutingParams::get<uint64_t>(unsigned index) const
-{
-    return uintParams[index];
-}
-
-template <>
-inline double RoutingParams::get<double>(unsigned index) const
-{
-    return doubleParams[index];
-}
-
-template <>
-inline std::string RoutingParams::get<std::string>(unsigned index) const
-{
-    return stringParams[index];
-}
-
 } // namespace crow
diff --git a/http/routing.hpp b/http/routing.hpp
index 0059760..e73297c 100644
--- a/http/routing.hpp
+++ b/http/routing.hpp
@@ -56,7 +56,7 @@
 
     virtual void handle(const Request& /*req*/,
                         const std::shared_ptr<bmcweb::AsyncResp>&,
-                        const RoutingParams&) = 0;
+                        const std::vector<std::string>&) = 0;
 #ifndef BMCWEB_ENABLE_SSL
     virtual void
         handleUpgrade(const Request& /*req*/,
@@ -131,82 +131,34 @@
 struct CallParams
 {
     H1& handler;
-    const RoutingParams& params;
+    const std::vector<std::string>& params;
     const Request& req;
     const std::shared_ptr<bmcweb::AsyncResp>& asyncResp;
 };
 
-template <typename F, int NInt, int NUint, int NDouble, int NString,
-          typename S1, typename S2>
+template <typename F, int NString, typename S1, typename S2>
 struct Call
 {};
 
-template <typename F, int NInt, int NUint, int NDouble, int NString,
-          typename... Args1, typename... Args2>
-struct Call<F, NInt, NUint, NDouble, NString, black_magic::S<int64_t, Args1...>,
+template <typename F, int NString, typename... Args1, typename... Args2>
+struct Call<F, NString, black_magic::S<std::string, Args1...>,
             black_magic::S<Args2...>>
 {
     void operator()(F cparams)
     {
         using pushed = typename black_magic::S<Args2...>::template push_back<
-            CallPair<int64_t, NInt>>;
-        Call<F, NInt + 1, NUint, NDouble, NString, black_magic::S<Args1...>,
-             pushed>()(cparams);
-    }
-};
-
-template <typename F, int NInt, int NUint, int NDouble, int NString,
-          typename... Args1, typename... Args2>
-struct Call<F, NInt, NUint, NDouble, NString,
-            black_magic::S<uint64_t, Args1...>, black_magic::S<Args2...>>
-{
-    void operator()(F cparams)
-    {
-        using pushed = typename black_magic::S<Args2...>::template push_back<
-            CallPair<uint64_t, NUint>>;
-        Call<F, NInt, NUint + 1, NDouble, NString, black_magic::S<Args1...>,
-             pushed>()(cparams);
-    }
-};
-
-template <typename F, int NInt, int NUint, int NDouble, int NString,
-          typename... Args1, typename... Args2>
-struct Call<F, NInt, NUint, NDouble, NString, black_magic::S<double, Args1...>,
-            black_magic::S<Args2...>>
-{
-    void operator()(F cparams)
-    {
-        using pushed = typename black_magic::S<Args2...>::template push_back<
-            CallPair<double, NDouble>>;
-        Call<F, NInt, NUint, NDouble + 1, NString, black_magic::S<Args1...>,
-             pushed>()(cparams);
-    }
-};
-
-template <typename F, int NInt, int NUint, int NDouble, int NString,
-          typename... Args1, typename... Args2>
-struct Call<F, NInt, NUint, NDouble, NString,
-            black_magic::S<std::string, Args1...>, black_magic::S<Args2...>>
-{
-    void operator()(F cparams)
-    {
-        using pushed = typename black_magic::S<Args2...>::template push_back<
             CallPair<std::string, NString>>;
-        Call<F, NInt, NUint, NDouble, NString + 1, black_magic::S<Args1...>,
-             pushed>()(cparams);
+        Call<F, NString + 1, black_magic::S<Args1...>, pushed>()(cparams);
     }
 };
 
-template <typename F, int NInt, int NUint, int NDouble, int NString,
-          typename... Args1>
-struct Call<F, NInt, NUint, NDouble, NString, black_magic::S<>,
-            black_magic::S<Args1...>>
+template <typename F, int NString, typename... Args1>
+struct Call<F, NString, black_magic::S<>, black_magic::S<Args1...>>
 {
     void operator()(F cparams)
     {
-        cparams.handler(
-            cparams.req, cparams.asyncResp,
-            cparams.params.template get<typename Args1::type>(Args1::pos)...);
+        cparams.handler(cparams.req, cparams.asyncResp,
+                        cparams.params[Args1::pos]...);
     }
 };
 
@@ -289,8 +241,7 @@
         using type = std::function<void(
             const crow::Request& /*req*/,
             const std::shared_ptr<bmcweb::AsyncResp>&, Args...)>;
-        using args_type =
-            black_magic::S<typename black_magic::PromoteT<Args>...>;
+        using args_type = black_magic::S<Args...>;
     };
 
     template <typename... Args>
@@ -299,8 +250,7 @@
         using type = std::function<void(
             const crow::Request& /*req*/,
             const std::shared_ptr<bmcweb::AsyncResp>&, Args...)>;
-        using args_type =
-            black_magic::S<typename black_magic::PromoteT<Args>...>;
+        using args_type = black_magic::S<Args...>;
     };
 
     template <typename... Args>
@@ -310,19 +260,18 @@
         using type = std::function<void(
             const crow::Request& /*req*/,
             const std::shared_ptr<bmcweb::AsyncResp>&, Args...)>;
-        using args_type =
-            black_magic::S<typename black_magic::PromoteT<Args>...>;
+        using args_type = black_magic::S<Args...>;
     };
 
     typename HandlerTypeHelper<ArgsWrapped...>::type handler;
 
     void operator()(const Request& req,
                     const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
-                    const RoutingParams& params)
+                    const std::vector<std::string>& params)
     {
         detail::routing_handler_call_helper::Call<
             detail::routing_handler_call_helper::CallParams<decltype(handler)>,
-            0, 0, 0, 0, typename HandlerTypeHelper<ArgsWrapped...>::args_type,
+            0, typename HandlerTypeHelper<ArgsWrapped...>::args_type,
             black_magic::S<>>()(
             detail::routing_handler_call_helper::CallParams<decltype(handler)>{
                 handler, params, req, asyncResp});
@@ -344,7 +293,7 @@
 
     void handle(const Request& /*req*/,
                 const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
-                const RoutingParams& /*params*/) override
+                const std::vector<std::string>& /*params*/) override
     {
         asyncResp->res.result(boost::beast::http::status::not_found);
     }
@@ -526,7 +475,7 @@
 
     void handle(const Request& req,
                 const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
-                const RoutingParams& params) override
+                const std::vector<std::string>& params) override
     {
         erasedHandler(req, asyncResp, params);
     }
@@ -547,20 +496,11 @@
     template <typename Func, unsigned... Indices>
     std::function<void(const Request&,
                        const std::shared_ptr<bmcweb::AsyncResp>&,
-                       const RoutingParams&)>
+                       const std::vector<std::string>&)>
         wrap(Func f, std::integer_sequence<unsigned, Indices...> /*is*/)
     {
         using function_t = crow::utility::FunctionTraits<Func>;
 
-        if (!black_magic::isParameterTagCompatible(
-                black_magic::getParameterTag(rule.c_str()),
-                black_magic::computeParameterTagFromArgsList<
-                    typename function_t::template arg<Indices>...>::value))
-        {
-            throw std::runtime_error("routeDynamic: Handler type is mismatched "
-                                     "with URL parameters: " +
-                                     rule);
-        }
         auto ret = detail::routing_handler_call_helper::Wrapped<
             Func, typename function_t::template arg<Indices>...>();
         ret.template set<typename function_t::template arg<Indices>...>(
@@ -578,7 +518,7 @@
   private:
     std::function<void(const Request&,
                        const std::shared_ptr<bmcweb::AsyncResp>&,
-                       const RoutingParams&)>
+                       const std::vector<std::string>&)>
         erasedHandler;
 };
 
@@ -603,70 +543,13 @@
     }
 
     template <typename Func>
-    typename std::enable_if<
-        black_magic::CallHelper<Func, black_magic::S<Args...>>::value,
-        void>::type
-        operator()(Func&& f)
+    void operator()(Func&& f)
     {
         static_assert(
-            black_magic::CallHelper<Func, black_magic::S<Args...>>::value ||
-                black_magic::CallHelper<
-                    Func, black_magic::S<crow::Request, Args...>>::value,
-            "Handler type is mismatched with URL parameters");
-        static_assert(
-            !std::is_same<void, decltype(f(std::declval<Args>()...))>::value,
-            "Handler function cannot have void return type; valid return "
-            "types: "
-            "string, int, crow::response, nlohmann::json");
-
-        handler = [f = std::forward<Func>(f)](
-                      const Request&,
-                      const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
-                      Args... args) { asyncResp->res.result(f(args...)); };
-    }
-
-    template <typename Func>
-    typename std::enable_if<
-        !black_magic::CallHelper<Func, black_magic::S<Args...>>::value &&
             black_magic::CallHelper<
-                Func, black_magic::S<crow::Request, Args...>>::value,
-        void>::type
-        operator()(Func&& f)
-    {
-        static_assert(
-            black_magic::CallHelper<Func, black_magic::S<Args...>>::value ||
-                black_magic::CallHelper<
-                    Func, black_magic::S<crow::Request, Args...>>::value,
-            "Handler type is mismatched with URL parameters");
-        static_assert(
-            !std::is_same<void, decltype(f(std::declval<crow::Request>(),
-                                           std::declval<Args>()...))>::value,
-            "Handler function cannot have void return type; valid return "
-            "types: "
-            "string, int, crow::response,nlohmann::json");
-
-        handler = [f = std::forward<Func>(f)](
-                      const crow::Request& req,
-                      const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
-                      Args... args) { asyncResp->res.result(f(req, args...)); };
-    }
-
-    template <typename Func>
-    typename std::enable_if<
-        !black_magic::CallHelper<Func, black_magic::S<Args...>>::value &&
-            !black_magic::CallHelper<
-                Func, black_magic::S<crow::Request, Args...>>::value,
-        void>::type
-        operator()(Func&& f)
-    {
-        static_assert(
-            black_magic::CallHelper<Func, black_magic::S<Args...>>::value ||
-                black_magic::CallHelper<
-                    Func, black_magic::S<crow::Request, Args...>>::value ||
-                black_magic::CallHelper<
-                    Func, black_magic::S<crow::Request,
-                                         std::shared_ptr<bmcweb::AsyncResp>&,
-                                         Args...>>::value,
+                Func, black_magic::S<crow::Request,
+                                     std::shared_ptr<bmcweb::AsyncResp>&,
+                                     Args...>>::value,
             "Handler type is mismatched with URL parameters");
         static_assert(
             std::is_same<
@@ -674,9 +557,7 @@
                 decltype(f(std::declval<crow::Request>(),
                            std::declval<std::shared_ptr<bmcweb::AsyncResp>&>(),
                            std::declval<Args>()...))>::value,
-            "Handler function with response argument should have void "
-            "return "
-            "type");
+            "Handler function with response argument should have void return type");
 
         handler = std::forward<Func>(f);
     }
@@ -690,11 +571,11 @@
 
     void handle(const Request& req,
                 const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
-                const RoutingParams& params) override
+                const std::vector<std::string>& params) override
     {
         detail::routing_handler_call_helper::Call<
             detail::routing_handler_call_helper::CallParams<decltype(handler)>,
-            0, 0, 0, 0, black_magic::S<Args...>, black_magic::S<>>()(
+            0, black_magic::S<Args...>, black_magic::S<>>()(
             detail::routing_handler_call_helper::CallParams<decltype(handler)>{
                 handler, params, req, asyncResp});
     }
@@ -825,18 +706,18 @@
         }
     }
 
-    std::pair<unsigned, RoutingParams>
-        find(std::string_view reqUrl, const Node* node = nullptr,
-             size_t pos = 0, RoutingParams* params = nullptr) const
+    std::pair<unsigned, std::vector<std::string>>
+        find(const std::string_view reqUrl, const Node* node = nullptr,
+             size_t pos = 0, std::vector<std::string>* params = nullptr) const
     {
-        RoutingParams empty;
+        std::vector<std::string> empty;
         if (params == nullptr)
         {
             params = &empty;
         }
 
         unsigned found{};
-        RoutingParams matchParams;
+        std::vector<std::string> matchParams;
 
         if (node == nullptr)
         {
@@ -848,7 +729,8 @@
         }
 
         auto updateFound =
-            [&found, &matchParams](std::pair<unsigned, RoutingParams>& ret) {
+            [&found,
+             &matchParams](std::pair<unsigned, std::vector<std::string>>& ret) {
             if (ret.first != 0U && (found == 0U || found > ret.first))
             {
                 found = ret.first;
@@ -856,74 +738,6 @@
             }
         };
 
-        if (node->paramChildrens[static_cast<size_t>(ParamType::INT)] != 0U)
-        {
-            char c = reqUrl[pos];
-            if ((c >= '0' && c <= '9') || c == '+' || c == '-')
-            {
-                char* eptr = nullptr;
-                errno = 0;
-                long long int value =
-                    std::strtoll(reqUrl.data() + pos, &eptr, 10);
-                if (errno != ERANGE && eptr != reqUrl.data() + pos)
-                {
-                    params->intParams.push_back(value);
-                    std::pair<unsigned, RoutingParams> ret =
-                        find(reqUrl,
-                             &nodes[node->paramChildrens[static_cast<size_t>(
-                                 ParamType::INT)]],
-                             static_cast<size_t>(eptr - reqUrl.data()), params);
-                    updateFound(ret);
-                    params->intParams.pop_back();
-                }
-            }
-        }
-
-        if (node->paramChildrens[static_cast<size_t>(ParamType::UINT)] != 0U)
-        {
-            char c = reqUrl[pos];
-            if ((c >= '0' && c <= '9') || c == '+')
-            {
-                char* eptr = nullptr;
-                errno = 0;
-                unsigned long long int value =
-                    std::strtoull(reqUrl.data() + pos, &eptr, 10);
-                if (errno != ERANGE && eptr != reqUrl.data() + pos)
-                {
-                    params->uintParams.push_back(value);
-                    std::pair<unsigned, RoutingParams> ret =
-                        find(reqUrl,
-                             &nodes[node->paramChildrens[static_cast<size_t>(
-                                 ParamType::UINT)]],
-                             static_cast<size_t>(eptr - reqUrl.data()), params);
-                    updateFound(ret);
-                    params->uintParams.pop_back();
-                }
-            }
-        }
-
-        if (node->paramChildrens[static_cast<size_t>(ParamType::DOUBLE)] != 0U)
-        {
-            char c = reqUrl[pos];
-            if ((c >= '0' && c <= '9') || c == '+' || c == '-' || c == '.')
-            {
-                char* eptr = nullptr;
-                errno = 0;
-                double value = std::strtod(reqUrl.data() + pos, &eptr);
-                if (errno != ERANGE && eptr != reqUrl.data() + pos)
-                {
-                    params->doubleParams.push_back(value);
-                    std::pair<unsigned, RoutingParams> ret =
-                        find(reqUrl,
-                             &nodes[node->paramChildrens[static_cast<size_t>(
-                                 ParamType::DOUBLE)]],
-                             static_cast<size_t>(eptr - reqUrl.data()), params);
-                    updateFound(ret);
-                    params->doubleParams.pop_back();
-                }
-            }
-        }
-
         if (node->paramChildrens[static_cast<size_t>(ParamType::STRING)] != 0U)
         {
             size_t epos = pos;
@@ -937,15 +751,14 @@
 
             if (epos != pos)
             {
-                params->stringParams.emplace_back(
-                    reqUrl.substr(pos, epos - pos));
-                std::pair<unsigned, RoutingParams> ret =
+                params->emplace_back(reqUrl.substr(pos, epos - pos));
+                std::pair<unsigned, std::vector<std::string>> ret =
                     find(reqUrl,
                          &nodes[node->paramChildrens[static_cast<size_t>(
                              ParamType::STRING)]],
                          epos, params);
                 updateFound(ret);
-                params->stringParams.pop_back();
+                params->pop_back();
             }
         }
 
@@ -955,15 +768,14 @@
 
             if (epos != pos)
             {
-                params->stringParams.emplace_back(
-                    reqUrl.substr(pos, epos - pos));
-                std::pair<unsigned, RoutingParams> ret =
+                params->emplace_back(reqUrl.substr(pos, epos - pos));
+                std::pair<unsigned, std::vector<std::string>> ret =
                     find(reqUrl,
                          &nodes[node->paramChildrens[static_cast<size_t>(
                              ParamType::PATH)]],
                          epos, params);
                 updateFound(ret);
-                params->stringParams.pop_back();
+                params->pop_back();
             }
         }
 
@@ -974,7 +786,7 @@
 
             if (reqUrl.compare(pos, fragment.size(), fragment) == 0)
             {
-                std::pair<unsigned, RoutingParams> ret =
+                std::pair<unsigned, std::vector<std::string>> ret =
                     find(reqUrl, child, pos + fragment.size(), params);
                 updateFound(ret);
             }
@@ -992,18 +804,16 @@
             char c = url[i];
             if (c == '<')
             {
-                const static std::array<std::pair<ParamType, std::string>, 7>
+                constexpr static std::array<
+                    std::pair<ParamType, std::string_view>, 3>
                     paramTraits = {{
-                        {ParamType::INT, "<int>"},
-                        {ParamType::UINT, "<uint>"},
-                        {ParamType::DOUBLE, "<float>"},
-                        {ParamType::DOUBLE, "<double>"},
                         {ParamType::STRING, "<str>"},
                         {ParamType::STRING, "<string>"},
                         {ParamType::PATH, "<path>"},
                     }};
 
-                for (const std::pair<ParamType, std::string>& x : paramTraits)
+                for (const std::pair<ParamType, std::string_view>& x :
+                     paramTraits)
                 {
                     if (url.compare(i, x.second.size(), x.second) == 0)
                     {
@@ -1050,15 +860,6 @@
                     2U * level, ' ') /*<< "("<<n->paramChildrens[i]<<") "*/;
                 switch (static_cast<ParamType>(i))
                 {
-                    case ParamType::INT:
-                        BMCWEB_LOG_DEBUG << "<int>";
-                        break;
-                    case ParamType::UINT:
-                        BMCWEB_LOG_DEBUG << "<uint>";
-                        break;
-                    case ParamType::DOUBLE:
-                        BMCWEB_LOG_DEBUG << "<float>";
-                        break;
                     case ParamType::STRING:
                         BMCWEB_LOG_DEBUG << "<str>";
                         break;
@@ -1188,7 +989,7 @@
     struct FindRoute
     {
         BaseRule* rule = nullptr;
-        RoutingParams params;
+        std::vector<std::string> params;
     };
 
     struct FindRouteResponse
@@ -1206,7 +1007,8 @@
             return route;
         }
         const PerMethod& perMethod = perMethods[index];
-        std::pair<unsigned, RoutingParams> found = perMethod.trie.find(url);
+        std::pair<unsigned, std::vector<std::string>> found =
+            perMethod.trie.find(url);
         if (found.first >= perMethod.rules.size())
         {
             throw std::runtime_error("Trie internal structure corrupted!");
@@ -1409,7 +1211,7 @@
         Trie& trie = perMethod.trie;
         std::vector<BaseRule*>& rules = perMethod.rules;
 
-        const std::pair<unsigned, RoutingParams>& found =
+        const std::pair<unsigned, std::vector<std::string>>& found =
             trie.find(req.url().encoded_path());
         unsigned ruleIndex = found.first;
         if (ruleIndex == 0U)
@@ -1504,7 +1306,7 @@
         }
 
         BaseRule& rule = *foundRoute.route.rule;
-        RoutingParams params = std::move(foundRoute.route.params);
+        std::vector<std::string> params = std::move(foundRoute.route.params);
 
         BMCWEB_LOG_DEBUG << "Matched rule '" << rule.rule << "' "
                          << static_cast<uint32_t>(*verb) << " / "
diff --git a/http/utility.hpp b/http/utility.hpp
index fd01bf1..75c84c2 100644
--- a/http/utility.hpp
+++ b/http/utility.hpp
@@ -34,12 +34,9 @@
 enum class TypeCode : uint8_t
 {
     Unspecified = 0,
-    Integer = 1,
-    UnsignedInteger = 2,
-    Float = 3,
-    String = 4,
-    Path = 5,
-    Max = 6,
+    String = 1,
+    Path = 2,
+    Max = 3,
 };
 
 // Remove when we have c++23
@@ -49,60 +46,6 @@
     return static_cast<typename std::underlying_type<E>::type>(e);
 }
 
-template <typename T>
-constexpr TypeCode getParameterTag()
-{
-    if constexpr (std::is_same_v<int, T>)
-    {
-        return TypeCode::Integer;
-    }
-    if constexpr (std::is_same_v<char, T>)
-    {
-        return TypeCode::Integer;
-    }
-    if constexpr (std::is_same_v<short, T>)
-    {
-        return TypeCode::Integer;
-    }
-    if constexpr (std::is_same_v<long, T>)
-    {
-        return TypeCode::Integer;
-    }
-    if constexpr (std::is_same_v<long long, T>)
-    {
-        return TypeCode::Integer;
-    }
-    if constexpr (std::is_same_v<unsigned int, T>)
-    {
-        return TypeCode::UnsignedInteger;
-    }
-    if constexpr (std::is_same_v<unsigned char, T>)
-    {
-        return TypeCode::UnsignedInteger;
-    }
-    if constexpr (std::is_same_v<unsigned short, T>)
-    {
-        return TypeCode::UnsignedInteger;
-    }
-    if constexpr (std::is_same_v<unsigned long, T>)
-    {
-        return TypeCode::UnsignedInteger;
-    }
-    if constexpr (std::is_same_v<unsigned long long, T>)
-    {
-        return TypeCode::UnsignedInteger;
-    }
-    if constexpr (std::is_same_v<double, T>)
-    {
-        return TypeCode::Float;
-    }
-    if constexpr (std::is_same_v<std::string, T>)
-    {
-        return TypeCode::String;
-    }
-    return TypeCode::Unspecified;
-}
-
 template <typename... Args>
 struct computeParameterTagFromArgsList;
 
@@ -115,16 +58,10 @@
 template <typename Arg, typename... Args>
 struct computeParameterTagFromArgsList<Arg, Args...>
 {
+    static_assert(std::is_same_v<std::string, std::decay_t<Arg>>);
     static constexpr int subValue =
         computeParameterTagFromArgsList<Args...>::value;
-    static constexpr int value =
-        getParameterTag<typename std::decay<Arg>::type>() !=
-                TypeCode::Unspecified
-            ? static_cast<unsigned long>(subValue *
-                                         toUnderlying(TypeCode::Max)) +
-                  static_cast<uint64_t>(
-                      getParameterTag<typename std::decay<Arg>::type>())
-            : subValue;
+    static constexpr int value = subValue * toUnderlying(TypeCode::String);
 };
 
 inline bool isParameterTagCompatible(uint64_t a, uint64_t b)
@@ -196,22 +133,9 @@
             uint64_t insertIndex = 1;
             for (size_t unused = 0; unused < paramIndex; unused++)
             {
-                insertIndex *= 6;
+                insertIndex *= 3;
             }
 
-            if (tag == "<int>")
-            {
-                tagValue += insertIndex * toUnderlying(TypeCode::Integer);
-            }
-            if (tag == "<uint>")
-            {
-                tagValue +=
-                    insertIndex * toUnderlying(TypeCode::UnsignedInteger);
-            }
-            if (tag == "<float>" || tag == "<double>")
-            {
-                tagValue += insertIndex * toUnderlying(TypeCode::Float);
-            }
             if (tag == "<str>" || tag == "<string>")
             {
                 tagValue += insertIndex * toUnderlying(TypeCode::String);
@@ -258,46 +182,11 @@
     static constexpr bool value = sizeof(test<F, Args...>(0)) == sizeof(char);
 };
 
-template <uint64_t N>
-struct SingleTagToType
-{};
-
-template <>
-struct SingleTagToType<1>
-{
-    using type = int64_t;
-};
-
-template <>
-struct SingleTagToType<2>
-{
-    using type = uint64_t;
-};
-
-template <>
-struct SingleTagToType<3>
-{
-    using type = double;
-};
-
-template <>
-struct SingleTagToType<4>
-{
-    using type = std::string;
-};
-
-template <>
-struct SingleTagToType<5>
-{
-    using type = std::string;
-};
-
 template <uint64_t Tag>
 struct Arguments
 {
-    using subarguments = typename Arguments<Tag / 6>::type;
-    using type = typename subarguments::template push<
-        typename SingleTagToType<Tag % 6>::type>;
+    using subarguments = typename Arguments<Tag / 3>::type;
+    using type = typename subarguments::template push<std::string>;
 };
 
 template <>
@@ -306,66 +195,6 @@
     using type = S<>;
 };
 
-template <typename T>
-struct Promote
-{
-    using type = T;
-};
-
-template <typename T>
-using PromoteT = typename Promote<T>::type;
-
-template <>
-struct Promote<char>
-{
-    using type = int64_t;
-};
-template <>
-struct Promote<short>
-{
-    using type = int64_t;
-};
-template <>
-struct Promote<int>
-{
-    using type = int64_t;
-};
-template <>
-struct Promote<long>
-{
-    using type = int64_t;
-};
-template <>
-struct Promote<long long>
-{
-    using type = int64_t;
-};
-template <>
-struct Promote<unsigned char>
-{
-    using type = uint64_t;
-};
-template <>
-struct Promote<unsigned short>
-{
-    using type = uint64_t;
-};
-template <>
-struct Promote<unsigned int>
-{
-    using type = uint64_t;
-};
-template <>
-struct Promote<unsigned long>
-{
-    using type = uint64_t;
-};
-template <>
-struct Promote<unsigned long long>
-{
-    using type = uint64_t;
-};
-
 } // namespace black_magic
 
 namespace utility
diff --git a/test/http/crow_getroutes_test.cpp b/test/http/crow_getroutes_test.cpp
index 23a511e..e5c9d6e 100644
--- a/test/http/crow_getroutes_test.cpp
+++ b/test/http/crow_getroutes_test.cpp
@@ -20,6 +20,7 @@
 namespace
 {
 
+using ::bmcweb::AsyncResp;
 using ::testing::Eq;
 using ::testing::IsEmpty;
 using ::testing::Pointee;
@@ -38,7 +39,9 @@
 {
     App app;
 
-    BMCWEB_ROUTE(app, "/")([]() { return boost::beast::http::status::ok; });
+    BMCWEB_ROUTE(app, "/")
+    ([](const crow::Request& /*req*/,
+        const std::shared_ptr<AsyncResp>& /*asyncResp*/) {});
 
     // TODO: "/" doesn't get reported in |getRoutes| today. Uncomment this once
     // it is fixed
@@ -50,12 +53,18 @@
 TEST(GetRoutes, TestlotsOfRoutes)
 {
     App app;
-    BMCWEB_ROUTE(app, "/")([]() { return boost::beast::http::status::ok; });
-    BMCWEB_ROUTE(app, "/foo")([]() { return boost::beast::http::status::ok; });
-    BMCWEB_ROUTE(app, "/bar")([]() { return boost::beast::http::status::ok; });
-    BMCWEB_ROUTE(app, "/baz")([]() { return boost::beast::http::status::ok; });
-    BMCWEB_ROUTE(app, "/boo")([]() { return boost::beast::http::status::ok; });
-    BMCWEB_ROUTE(app, "/moo")([]() { return boost::beast::http::status::ok; });
+    BMCWEB_ROUTE(app, "/")
+    ([](const Request& /*req*/, const std::shared_ptr<AsyncResp>& /*res*/) {});
+    BMCWEB_ROUTE(app, "/foo")
+    ([](const Request& /*req*/, const std::shared_ptr<AsyncResp>& /*res*/) {});
+    BMCWEB_ROUTE(app, "/bar")
+    ([](const Request& /*req*/, const std::shared_ptr<AsyncResp>& /*res*/) {});
+    BMCWEB_ROUTE(app, "/baz")
+    ([](const Request& /*req*/, const std::shared_ptr<AsyncResp>& /*res*/) {});
+    BMCWEB_ROUTE(app, "/boo")
+    ([](const Request& /*req*/, const std::shared_ptr<AsyncResp>& /*res*/) {});
+    BMCWEB_ROUTE(app, "/moo")
+    ([](const Request& /*req*/, const std::shared_ptr<AsyncResp>& /*res*/) {});
 
     app.validate();
 
diff --git a/test/http/utility_test.cpp b/test/http/utility_test.cpp
index 957c13d..6726455 100644
--- a/test/http/utility_test.cpp
+++ b/test/http/utility_test.cpp
@@ -220,17 +220,9 @@
 
 TEST(Router, ParameterTagging)
 {
-    EXPECT_EQ(6 * 6 + 6 * 3 + 2, getParameterTag("<uint><double><int>"));
-    EXPECT_EQ(1, getParameterTag("<int>"));
-    EXPECT_EQ(2, getParameterTag("<uint>"));
-    EXPECT_EQ(3, getParameterTag("<float>"));
-    EXPECT_EQ(3, getParameterTag("<double>"));
-    EXPECT_EQ(4, getParameterTag("<str>"));
-    EXPECT_EQ(4, getParameterTag("<string>"));
-    EXPECT_EQ(5, getParameterTag("<path>"));
-    EXPECT_EQ(6 * 6 + 6 + 1, getParameterTag("<int><int><int>"));
-    EXPECT_EQ(6 * 6 + 6 + 2, getParameterTag("<uint><int><int>"));
-    EXPECT_EQ(6 * 6 + 6 * 3 + 2, getParameterTag("<uint><double><int>"));
+    EXPECT_EQ(1, getParameterTag("<str>"));
+    EXPECT_EQ(1, getParameterTag("<string>"));
+    EXPECT_EQ(2, getParameterTag("<path>"));
 }
 
 TEST(URL, JsonEncoding)
