final commit: leader election and swarm implemented