refactor array in sp tool