Update the overlord solution

This isn't a lesson JS code structure, but fwiw, it'd be far better to have a module for this code and to separate it into appropriate functions. It would be evidently wrong to have ruby code in one giant function, so it's not better to do it in JS.