reindent
break out lookup functions
move lookups out of loop
move org lookup out of loop
move package lookup out to own fn
move packagegroup lookup out to own fn
reindent