Improve collect script