Updated permutateLexicographically sub module.
Simplified permutateLexicographically procedure.