Add block iterator and refactor