modified the function to return correct parents edorgs