Some consistency checks.
Remove states.
Remove proc.
Purely functional implementation for externals.
Move reduce state and introduce Expand.
Progress on expansion.