Fix JSLint issues and add more documentation.