Use std::max instead of ternary operator