Refactor event listener to use EntityExtractor