refactored (and fixed bug) in adding collections