collectBlocks() refactor
Merge pete's refactor