improved javascript clients verify behaviour, increased test coverage, fixed minor bug and improved comments for API