Optimized JS a bit.  match() is 300x faster than exec().  Couple other nits.