Close GH-706: Minor code improvements for lib.js. closes #580.