Refactor core state and indexes

Add update-index multimethod, remove 'engine' structure.