add cache for extracting terms