Updated collect function

I updated the collect function to pass JS lint.