reduce the module size of the html box handling code by splitting into smaller sections. No functional code change.