lots of optimizations, removed unused rest values from generated cell states