more documentation and cleanup of test.js