Better version of collect.py