modified to use constexpr