Block refactoring

BlockRefactor ready to merge with master.