added maxPermutatian function...