Made this about twice as fast. Replaced split calls to charCodeAt loops, added length cachine to loops.