Some refactorings, added elect method