ksh loop refactor
ksh loop refactor