adjust how max is calculated, utilizing Math.max