use loop-tpl; minor cleanup