Good JS Citizenry

Moves things out of the global scope.