refactoring and implemented collector