Modified code for arrays to hopefully fix a bug.
Merge pull request #19 from mshamash/master

Modified code for arrays to hopefully fix a bug.