Refactored application for extracting first terms.