implemented most of the test suite. Can be run (from a web accssible server with mocha test.js