Refactor attribute handling for term plugin