Refactor excerpt extraction