Splits up the giant `loadTemplate` function into smaller pieces.
Jury's still out whether this would be better with promises instead of `async`. Probably would be.