Refactor loadDynamicContent into slightly more digestable pieces

This is just a trivial refactor, more than anything to test the
waters with javascript code style stuff before I get ready to
do some actual work with the ajax injection method for the
Local backend.

I tried to break down some of the logic in the loadDynamicContent
into slightly more digestable component methods, and also made
a couple of minor spacing tweaks.2