Try check for forbidden codons in region before testing max, as the former is a fairly cheap computation.