Fixed block name collisions, some refactoring