Sort dictionary before comm

This avoids warnings when the dictionary's sort order is different
from the one used in the script.
Point to state transition diagram
Refactor buffering into I/O and pool buffers

Also abstract pool buffers into a structure that allows
them to point to a file location.
Page-out buffers to temporary file