Refactor tests.
Fix jsDoc and typos.
Remove unused code.
Remove getFromCookie method from API.