deep copy of config
replace loop with forEach
invalid loop condition
pace type config added, config initialization simplified