Week 5, Challenge 4: Added global array

Altered first part to use global array