refactored collection function, and fixed error reported on trigger determination