Extracted building functions to an include file for ease of maintenance
and readability.

Signed-off-by: Rion Parsons <rkparson@ucsc.edu>