Double-check auth in critical functions. Improve use of the global namespace.