For #125, Moved collection implementation to different functions