tidy up API JSDoc, rename a couple variables, start adding @static to static functions