Refactored the collection parts to be more compact and modular