Better scoping for client side modules

Currently, the client side 'modules' are wrapped with an enclosing function to ensure nothing is put into the global namespace. Being able to scope things at the module level would be nicer and more useful.