Atlas funcgraph eid fix

this function is over 400 lines...  is there any logic in it that could become functionalized?  review and understanding of a monolithic code block like this is rough.