Implement collapse blocks as a Visitor