use foreach instead of for loop
added coordinator and election message
finished leader selection