added jsdoc, added stuff to the README, fixes a few small bugs, added tests