Removed trailing whitespace.
Made export explicit.
Cleanups (long lines, bad var names, typos).
Fixed bad var name.