version 2 of leader election with removals of tman corrected