added functionality to determine leader
Merge remote-tracking branch 'origin/andreas'