updated loop for measuring numbers of relationships
added example code