def process_states(instates)
      outstates = {}
      instates.each do |inst|
        name = inst.delete(:name)
        outstates[name] ||= []
        outstates[name] << inst
      end
      return outstates
    end
def process_states(instates)
      outstates = {}
      instates.each do |inst|
        name = inst.delete(:name)
        outstates[name] ||= []
        outstates[name] << inst
      end
      return outstates
    end
consolidate same-name states and (eventually) combine / optimize where
 appropriate.