swapped out reverse reduce for reduceRight and added length.