implementation, tests and jsdoc