Re-factor active blocks into new data structure

* Create YAML based serialization for new active blocks
* Do a number of optimizations
* Remove a lot of global references