Added internal parameter to blocks.  Some refactoring and cleanup.