modify the function getDataFromArray