improved documentation and unit tests for lang.js