using `std::min()` and `std::max()` can improve readability