add tests and codes for collections