Update LDoc information to include the priority order of key groups.

Pull a temporary function out of an inner loop.