This patch moves the complicated processing loops out of top-level functions to make them more readable and thus reduce gocyclo complaints for this operation. Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>