isolate collect_all from main