Complete rewrite of the Block system
Fixes global scope error