moving the array indexing code into the Array class