Improve collector code