Updating environment setting for v2.filter.gen
simplified function def in v2.filter.gen
Changed parent environment setting
Added end state counters