JoinGraph refactored and commented