Added array making code to the index controller action