core: Use Machine#state wherever possible so we update the index