Calculate majority and update devices (partially tested)