Updated stategen code