Avoid multiplication at the cost of one extra Int in state
Inline view functions
Add another generator

Also some clean up