Added dynamic array handling