Switched conditional to have a dynamic max.