moved majority voting algo