Improved term generator