Replace usage of [] with array