use std::max instead of ?: