The path I chose was more or less a compromise. As much as possible, I tried to identify distinct parts or organizational units in my Ajax application code. Then, for each unit, I created a singular global object containing the associated variables and functions. In effect, I broke the code up into object "modules". "Module" is a better descriptor than "object", because there still are no constructors and no real use of "this", nor is anything even remotely private (other than the few function definitions I moved inside of other functions). In other words, the code has not so much been rewritten as reorganized or relabeled. Frankly, the code's sanity may not be much improved, but mine should be.