Split into two smaller subs.

Consider using a builder method to further simplify assembling the format.