Omitted unnecessary lines.
Changed to one-dimensional array