some new ideas:
- memoization via a state monad
- staging