Change the whole logic for block to fix bugs and performance improvements.