probably doesn't really matter, but this is faster if you do exchange `sqrt` and `max`