modify the structure of array; modify the logic of parameter; fix the memory leak issue