Refactor some of this into separate files. Support for renaming of blocks. Added proper BlockInstance class to hold block names. Automatic sequential default numbering of new blocks.