Optimizing Inmemory counter processor and removing cyclic dependency