Collect free terms and types in one traversal
Grabbag of optimizations