adding code for field grouping