Avoiding usage of global Javascript scope