Merged too quickly - added documentation and fixed JSLint problems. And a typo.