I wanted to move this overlay code out into a different file entirely but ran into trouble doing so. This file would be much easier to comprehend if I could separate the logic and presentation. What I'm mostly having trouble with is how to require code. It appears that I have to use config.loadModule before I can require code but loadModule wants a callback and I can't require code until the loadModule callback has fired. Then the require calls keep returning null or undefined or asking me for function parameters. I'm just not that hot to keep screwing around guessing at what's going on. I look at the docs for ace, I look at the docs for requirejs, and still don't really have enough information. I look around in the source code and get lost in context. I see plenty of `require('stuff')` and wonder what black magics it takes to make it happen. I also don't really know what `define(string, array, function` does. 

I'm used to using require on node. I just say `require('aModule')` and I've got the module before the next line of code executes. I don't know how to get the same effect here.

It is likely better to have someone more familiar with ACE go through and refactor this. I mean it works but I don't have a year to dedicate to studying ACE. This thing is massive you know?