Updated jshint and mocha configuration.
Added reset() API and fixes for bugs discovered while writing UTs.
Added tests.