added implementation based on collections