fix up variable names, exports, and save some forks.

sidenote: tests do not use `function' keyword...