Fix type annotation
Add reducers, better compaction