Consistent use of ch to avoid array indexing more than once.

Replace the couple places where the string character array was being indexed twice in the same block instead of the character being cached locally. Cleanup formatting of the switch statements to follow conventions.
MIT licence