Add initial apply-datom and entity-state code.