made code more clear, and implemented explicit support for blocks, fix #1668