Last step of refactoring before adding support for > 1000 entities.
Last step of refactoring before adding support for > 1000 entities.

Make helper functions.  One extracts list parameters.
One creates links more simply.  This is cleaning up the large
function body so I can move stuff around more radically.

Patch by: Dan Bentley

--HG--
extra : convert_revision : svn%3A32761e7d-7263-4528-b7be-7235b26367ec/trunk%402912

SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange