Internalizing more of the code into a central, cacheable JS file.