Startup enhancements and refactoring.

Making sure this can run from anywhere, no matter where it was
called from. Changed some names.