updated array handling