added indexes and state table