consolidating field generation logic and context