Use string.charAt(n) instead of string[n]

Safari doesn't seem to like the string indices in some circumstances
Docs update
Style tweaks