support fields parameter and code cleanup.