Major refactoring, including addition of block.c/.h to make system more orthogonal.